Home>

When I was practicing sending images using the LINE API, I succeeded in sending one letter and one image, but the second one was not sent. Why is this? And how can I rewrite this problem?

def send_LINE ():
    token = "Ah ah ah ah ah ah ah ah ah ah"
    api = "https://notify-api.line.me/api/notify"
    #Create the information I want to send
    send_contents = "" "
    Oh Oh Oh Oh
Ah ah ah ah
"" ""
    image_files = ["./chart_H1.png", "./chart_M5.png"] #Specify the image path
    # Read as binary data
    image_bainary_H1 = open (image_files [0], mode = "rb")
    image_bainary_M5 = open (image_files [1], mode = "rb")
    # Make information dictionary type
    token_dic = {"Authorization": "Bearer" + "" + token}
    send_dic = {"message": send_contents}
    image_dic_H1 = {"imageFile": image_bainary_H1}
    image_dic_M5 = {"imageFile": image_bainary_M5}
    # Send a notification to LINE
    requests.post (api, headers = token_dic, data = send_dic, files = image_dic_H1)
    requests.post (api, headers = token_dic, files = image_dic_M5)