Python's `urllib2`: Why do I get error 403 when I `urlopen` a Wikipedia page?

前端 未结 6 1195
轻奢々
轻奢々 2020-12-07 11:07

I have a strange bug when trying to urlopen a certain page from Wikipedia. This is the page:

http://en.wikipedia.org/wiki/OpenCola_(drink)

This

6条回答
  •  渐次进展
    2020-12-07 11:26

    I made a workaround for this using php which is not blocked by the site I needed.

    it can be accessed like this:

    path='http://phillippowers.com/redirects/get.php? 
    file=http://website_you_need_to_load.com'
    req = urllib2.Request(path)
    response = urllib2.urlopen(req)
    vdata = response.read()
    

    This will return the html code to you

提交回复
热议问题