putting dicts in post requests for data in micropython doesn't work

April 28, 2024, 11:20

timestepyt

I'm trying to access the Geometry Dash severs from my Raspberry Pi Pico W but I need to pass data={"secret":"Wmfd2893gb7", "str":"RobTop"}. However when passing dicts, it gives me this error.
Traceback (most recent call last):
  File "<stdin>", line 27, in <module>
  File "requests/__init__.py", line 184, in post
  File "requests/__init__.py", line 123, in request
TypeError: object with buffer protocol required
This is my code snippet
py
data_dict = {
        "secret":"Wmfd2893gb7",
        "str":"RobTop"
        }
res = urequests.post(" https://www.boomlings.com/database/getGJUsers20.php ", headers={"User-Agent":""}, data=data_dict).text
print(res)

timestepyt

I fixed it, normally I only needed to do User-Agent: "" because I could put a dict in data, but now I need to add "Content-Type":"application/x-www-form-urlencoded" too so it sends it correctly