Anti-crawler and module get post

Source: Internet
Author: User

The Urllib module can only be used with get

URLLIB2 module has both get and post

url = Urllib2.urlopen ('

Http://www.zhanjibao.com/core/search/player ', data = ' Nickname=%e9%9b%aa%e5%9f%9f%e6%9e%ab

') has data representing the POST request

URLLIB2 Module

Request requests are anti-crawler

Add-header in the form of a dictionary, separated by commas, single quotation marks cause two parts of the content

req = Urllib2. Request (' http://www.zhanjibao.com/core/search/player ', data = ' nickname=%e9%9b%aa%e5%9f%9f%e6%9e%ab ')
Req.add_header (' user-agent ', ' mozilla/5.0 (Windows NT 10.0; WOW64) applewebkit/537.36 (khtml, like Gecko) chrome/49.0.2623.22 safari/537.36 SE 2.X METASR 1.0 ')

Anti-crawler and module get post

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.