Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4141461
  • 博文数量: 447
  • 博客积分: 1241
  • 博客等级: 中尉
  • 技术积分: 5786
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-27 06:48
个人简介

读好书,交益友

文章分类

全部博文(447)

文章存档

2023年(6)

2022年(29)

2021年(49)

2020年(16)

2019年(15)

2018年(23)

2017年(67)

2016年(42)

2015年(51)

2014年(57)

2013年(52)

2012年(35)

2011年(5)

分类: Python/Ruby

2020-11-25 20:40:07


点击(此处)折叠或打开

  1. import requests

  2. url=''
  3. headers={
  4.     'User-Agent':'self-defind-user-agent',
  5.     'Cookie':'JSESSIONID=CB0A9E6BF4D5C56AC88411B2C16A3AD3',
  6.     'Upgrade-Insecure-Requests':'1',
  7.     #'Referer':''
  8. }
  9. r = requests.get(url,headers=headers,allow_redirects=False)

  10. #print(r.headers['Location'])
  11. print(r.status_code)
返回 302

点击(此处)折叠或打开

  1. import requests

  2. url=''
  3. headers={
  4.     'User-Agent':'self-defind-user-agent',
  5.     'Cookie':'JSESSIONID=CB0A9E6BF4D5C56AC88411B2C16A3AD3',
  6.     'Upgrade-Insecure-Requests':'1',
  7.     'Referer':''
  8. }
  9. r = requests.get(url,headers=headers,allow_redirects=False)

  10. #print(r.headers['Location'])
  11. print(r.status_code)
返回200
阅读(1761) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~