🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Micropython post error

    FAQS
    2
    2
    5.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jarain78
      last edited by

      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

      M 1 Reply Last reply Reply Quote 0
      • M
        Microbug @jarain78
        last edited by

        @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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post