I'm trying to make a program which will automatically post trading ads on the roblox trading site https://rblx.trade. But the problem is that whenever I try to make post request, it gives an error "CsrfValidationFailed". my current code:
headers = {
"nickname": "Tortur4dVibe"
}
cookies = {"rblx-csrf-v4": data['csrf'],"rblx-sess-v1": data["rblx-sess-v1"]}
response = requests.post(RBLXTRADE_GENERATE_AUTH_TOKEN_URL, headers=headers,cookies=cookies)
print(response.text) #{"success":false,"error":{"code":"CsrfValidationFailed"}}
I also tried this:
with requests.Session() as s:
url = 'https://rblx.trade'
r = s.get(url,headers=headers)
soup = BeautifulSoup(r.text, 'lxml')
csrfToken = soup.find('input',attrs = {'name':'csrfToken'})#['value']
print(csrfToken) # NoneType
print(s.cookies.get_dict()) # {}
API docs for the site: https://rblx.trade/docs/index.html
I tried searching it up in html in browser and using bs4 in python, also tried getting in through request.cookies and just coping cookies from my browser.