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

    Micropython post error

    Scheduled Pinned Locked Moved FAQS
    2 Posts 2 Posters 7.2k Views 1 Watching
    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 Offline
      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 Offline
        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

        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
        • First post
          Last post