#async http csrf problem blah blah (IDK WHAT'S THE PROBLEM)

1 messages ยท Page 1 of 1 (latest)

rare condor
#

_ _

#

Problem: some params are missing in cookie of async version of code

frank geyser
#

use aiohttp

rare condor
#

๐Ÿ˜

#

i want to use httpx only no aiohttp

rare condor
frank geyser
rare condor
#

i want solution, i don't wanna debate on aiohttp vs httpx

shadow cairn
#

Line 73 in your async code

#

You are not passing the data dict in the post method of httpx client

rare condor
shadow cairn
#
    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

rare condor
#

๐Ÿ‘