Saturday 25 June 2022

How to use proxies within browser_cookie3 or any similar library that helps grab cookies?

I'm trying to populate cookies from a domain using this library browser_cookie3. It appears to be doing fine. However, the only and main problem is that I can't figure out any way how to supply proxies within this library to get cookies from the location the proxy is from.

For example, if I use this domain www.nordstrom.com within that library and execute the script below:

import browser_cookie3

cj = browser_cookie3.chrome(domain_name='www.nordstrom.com')

for item in cj:
    if not 'internationalshippref' in item.name:
        continue
    cookie = f'{item.name}={item.value}'
    break

print(cookie)

I always get the following result as my current location is Bangladesh:

internationalshippref=preferredcountry=BD&preferredcurrency=BDT&preferredcountryname=Bangladesh

How to get cookies from the above site using proxies within browser_cookie3 or any other library?



from How to use proxies within browser_cookie3 or any similar library that helps grab cookies?

No comments:

Post a Comment