So, I was writing a program that uses the requests library. While trying to do something I got this error:
Traceback (most recent call last):
File "C:\Users\myste\Desktop\Bang.com keker\e.py", line 10, in <module>
print(requests.get('https://www.bang.com/login_check',headers=headd,json=content).text)
File "C:\Python39\lib\site-packages\requests\api.py", line 76, in get
return request('get', url, params=params, **kwargs)
File "C:\Python39\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Python39\lib\site-packages\requests\sessions.py", line 528, in request
prep = self.prepare_request(req)
File "C:\Python39\lib\site-packages\requests\sessions.py", line 456, in prepare_request
p.prepare(
File "C:\Python39\lib\site-packages\requests\models.py", line 319, in prepare
self.prepare_body(data, files, json)
File "C:\Python39\lib\site-packages\requests\models.py", line 469, in prepare_body
body = complexjson.dumps(json)
File "C:\Python39\lib\json\__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "C:\Python39\lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\Python39\lib\json\encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "C:\Python39\lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type set is not JSON serializable
This is my code:
import requests
headd = {
"User-Agent":"Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36",
"Pragma":"no-cache" ,
"Accept":"*/*"
}
content = {
f"\"_username\":\"MY_EMAIL\",\"_password\":\"MY_PASSWORD\",\"_remember_me\":true"
}
print(requests.get('https://www.bang.com/login_check',headers=headd,json=content).text)
What this program basically does is, it will take a list of your email and passwords and then checks if they are valid. Its incase you forget your accounts password. Dont ask me what is the point of this program cuz idk myself, I got a request to make this so I am making it moyai
Your content is actually a set
not a dict
. Replace it with something like:
content = {"_username": "my_email", "_password": "my-password"} # etc...