how to use urequests to post files?
I want to post some files to remote server.But I found that the urequests.post() doesn`t have parameter files.
this is in python:
import requests
payload = {}
files = [
('uploads2', open('/D:/cat.png','rb')),
('uploads1', open('/D:/tecsun/456.jpg','rb'))
]
headers= {}
response = requests.request("POST", url, headers=headers, data = payload, files = files)
print(response.text.encode('utf8'))
how to use this in micropython? thank you !
POST Request with BASIC AUTH - How to?
Dear all,
I am trying to implement a simple pull request with basic auth on the esp32. As seen at https://github.com/micropython/micropython-lib/pull/311, it seems like it is implemented in urequests.post and can be called by: res = urequests.post(request_url, headers={'content-type': 'application/json'}, data=post_data, auth=('username','password')).json() print(res.text).
However it seems like this doesn't work. Am I not calling this function right? There seems to be no documentation on requests in the official documentation.
Sincerely with Many Thanks,
Clement