BERNARD Julien BERNARD Julien - 9 months ago 123
Python Question

"The owner of this website has banned your access based on your browser's signature" ... on a url request in a python program

When doing a simple request, on python (Entought Canopy to be precise), with urllib2, the server denies me access :

data = urllib.urlopen(an url i cannot post because of reputation, params)



Access denied | used CloudFlare to restrict access

The owner of this website ( has banned your access based on your browser's signature (14e894f5bf8d0920-ua48).

This is a apparently a generic issue, so I found several clues on the web.

A firewall, proxy, a browser plugin or extension may be throwing a false positive. Try visiting the site with a different browser as an alternative way of accessing the site.

The "Checking your browser before accessing ( occurs when the site owner has turned on a DDoS protection and mitigation tool called "I'm Under Attack". The page will generally go away and grant you access to the site after 5 seconds.

Note: You will need to have both JavaScript and Cookies turned on in your browser to pass the check. The check is in place to make sure that you are not part of a botnet."

The answers are rather clear, except for this one thing ... *I'm not using any browser! The request is done trough a python program, with an
request ...

Does this mean I'm supposed to have, like, cookies and JavaScript turned on in ... Enthought Canopy? Does this sentence makes any sentence at all? I barely understand anything about this browser specific check activating when trying to access the site with a basic request from a programming console. And that's why I ask for your help.

Why does it happen? How to bypass it?

Answer Source

What this site is "checking" is not your browser, it's the "user agent" - a string your client program (browser, Python script or whatever) eventually sends as a request header. You can specify another user agent, cf Changing user agent on urllib2.urlopen.