Micropython post error
-
Hello everybody, I have a problem, I'm trying to send a wav file using the "urequests" library, but I can't do it. I use a M5GO (FIRE) and micro-piton returns the following error:
TypeError: object with buffer protocol required
Any one knows how I can solve this?.
This is my code:
url = "http://server_addres/wav_file" fin = wave.open('/sd/temp.wav', 'rb') file_to_send= {'file': ubinascii.b2a_base64(fin)} header={"content-type":"audio/wav", 'file': ubinascii.b2a_base64(fin)} # data=file_to_send, try: r = urequests.post(url, headers=header) print (r.text) finally: print("Close...") fin.close()
Regards
Jarain78
-
@jarain78 Hello,
I'm currently facing the same pb with my M5dial:
Any idea ?
URL_REFRESH='https://api.netatmo.com/oauth2/token' params={ 'grant_type':'refresh_token', "client_id":'xxx', "client_secret":'xxx', "refresh_token":'xxx' } rep=requests.post(URL_REFRESH, data=params)
=> TypeError: object with buffer protocol required