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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login