QUERY · ISSUE
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 !
CANDIDATE · ISSUE
urequests induces esp8266 crash with a message LmacRxBlk:1
I am using micropython on an esp8266 board, when I use urequests to post data to 2 different servers, after serval loops, esp8266 crashes with this message LmacRxBlk:1, need to hard reset the board to make it work again.
The code is like this:
while True:
r1 = urequests.post(SOME_URL,headers=xxx,data=xxxx)
r2= urequests.post(SOME_URL_1,headers=xxxx,data=xxxx)
time.sleep(300)
But if I post data to only 1 server, it never comes to the crash LmacRxBlk:1.
Does anybody know why?
Please read the docs: http://docs.micropython.org/en/latest/esp8266/esp8266/general.html#sockets-and-wifi-buffers-overflow