[How-to] HTTP endpoint on Flow Creator to upload a file - python POST request format

0
Hi community,   I am trying to upload an image to a http endpoint on SFC (flow-creator) from python code. I have succeeded in fetching the auth-token from the IED where the endpoint resides. Can someone clarify the right way to upload an image, especially how to send the auth-token in the POST request?  I have tried this (I have also tried to send the auth token in the payload):   def upload_to_endpoint(self, filename, img_data, http_ep, token): payload = {} files = [ ('file', (filename, img_data, 'image/png')) ] headers = {'authToken': token} response = requests.request("POST", http_ep, headers=headers, data=payload, files=files) print(response.text) I get authentication error.
asked
1 answers
0

Hi, 

 

try using this header => Cookie: “authToken=<token>”

 

Leave a comment if it helps :) 

answered