How to access python disguised as a browser
This article will explain in detail how to visit python disguised as a browser. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Masquerade as browser access
Some websites are disgusted with the visit of the crawler, so they all refuse the request. At this point, we need to pretend to be a browser, which can be achieved by modifying the header in the http package:
Headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) Rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6'} req = urllib2.Request (url = 'http://secure.verycd.com/signin/*/http://www.verycd.com/', data = postdata, headers = headers) this is the end of the article on "how to access python disguised as a browser". I hope the above content can be helpful to you, so that you can learn more knowledge. If you think the article is good, please share it for more people to see.