Skip to content Skip to sidebar Skip to footer

Python3 - Requests - Bs4 - Cloudflare -> 403 Forbidden Not Use Local Proxy

Codes aren't working. It has got 403 error because system using cloudflare When i am using anyone http proxy(burp suite/fiddler etc.), I see csrfToken. It works. Why it works when

Solution 1:

Cloudflare performs JavaScript checks on the browser and returns a session if the checks have been successful. If you want to run a one-off script to download stuff off of a CloudFlare protected server, add a session cookie from a previously validated session you obtained using your browser.

The session cookie is named __cfduid. You can get it by fetching a resource using your browser and then opening the developer tools and the network panel. Once you inspect the request, you can see the cookies your browser sent to the server.

Then you can use that cookie for requests using your script:

cookies = {
    "__cfduid": "xd0c0985ed80ffbc4dd29d1612168766",
}
response = requests.get(image_url, cookies=cookies)
response.raise_for_status()  

Post a Comment for "Python3 - Requests - Bs4 - Cloudflare -> 403 Forbidden Not Use Local Proxy"