16

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)

print data.read()

Error:

Access denied | play.pokemonshowdown.com used CloudFlare to restrict access

The owner of this website (play.pokemonshowdown.com) 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.

https://support.cloudflare.com/hc/en-us/articles/200171806-Error-1010-The-owner-of-this-website-has-banned-your-access-based-on-your-browser-s-signature:

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.

https://support.cloudflare.com/hc/en-us/articles/200170176-Why-am-I-getting-a-Checking-your-Browser-before-accessing-message-before-entering-a-site-on-CloudFlare-:

The "Checking your browser before accessing (insertsite.com) 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 urllib.urlopen 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?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
BERNARD Julien
  • 209
  • 1
  • 2
  • 10
  • 3
    Try changing your user agent. See [this post](http://stackoverflow.com/questions/802134/changing-user-agent-on-urllib2-urlopen). – Kevin Jul 23 '14 at 14:51

2 Answers2

16

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.

Community
  • 1
  • 1
bruno desthuilliers
  • 75,974
  • 6
  • 88
  • 118
0

I just saw it with Safari from my home IP, looking at a site I author! After performing a login to cloudflare website and hitting refresh its back. Probably my mobile internet was too slow (in New Zealand) and the javascript did not load in time? I have DDOS protection and "under attack" enabled AFAIK.

Tomachi
  • 1,665
  • 1
  • 13
  • 15