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