#async http csrf problem blah blah (IDK WHAT'S THE PROBLEM)
1 messages ยท Page 1 of 1 (latest)
use aiohttp
btw test command:
python file.py https://xpshort.com/1
why
i want solution, i don't wanna debate on aiohttp vs httpx
Line 73 in your async code
You are not passing the data dict in the post method of httpx client
๐คฃ shame on me
async def _get_link(self, data: dict) -> str:
"""Gets the link"""
ad_form_data = data["ad_form_data"]
token_field = data["token_field"]
token_unlocked = data["token_unlocked"]
csrf_token = data["csrf_token"]
cookie = data["cookie"]
print(cookie)
HEADERS = {
'user-agent': 'Magic Browser',
'accept': 'application/json, text/javascript, */*; q=0.01',
'accept-language': 'en-US,en;q=0.5',
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
'x-requested-with': 'XMLHttpRequest'
}
data = {
"_method": "POST",
"_csrfToken": csrf_token,
"ad_form_data": ad_form_data,
"_Token[fields]": token_field,
"_Token[unlocked]": token_unlocked
}
response = await self.client.post(BASE_URL + "links/go",
headers=HEADERS,
cookies=cookie)
yeah right here
you are only passing headers and cookies, not the data
๐