Python爬虫传送post请求要携带哪些参数

2025-04-05 00:04:15
推荐回答(1个)
回答(1):

head = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
      'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36',
      'Accept-Language': 'zh-CN,zh;q=0.8', 'X-Requested-With': 'XMLHttpRequest'}
r = requests.get(ip_add, headers=head)

你用Chrome,按F12,打开在下面的tab中选择Network。然后按红点,然后输入你要的具体网址,看一下下面浏览器都post什么了就知道了。copy下来到你的head中。