python requests获取response headers中的location
来源:互联网 发布:制定项目计划 软件 编辑:程序博客网 时间:2024/04/30 03:25
只要类似如下做即可
import requestsres = requests.post(url=url, headers=headers, data=data, allow_redirects=False) # 注 allow_redirects=False是必须的print(res.headers['location']) # 获取其他的也是一样的
样例
import requestsurl = 'http://paste.ubuntu.com/'headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',}data = { 'poster': 'test', 'syntax': 'cpp', 'content': 'test',}session = requests.Session()res = session.post(url=url, headers=headers, data=data, allow_redirects=False)print(res.headers['location'])
阅读全文
0 0
- python requests获取response headers中的location
- 获取网站中response.Headers["location"],找到抓取页面
- 如何通过Python+Selenium+PhantomJS/Chrome获取HTTP状态和Response Headers
- Fetch / ajax 不能获取response中的所有headers的解决方法(适用nginx)
- python requests库翻译(三)-response
- python中的requests使用
- Python中的requests
- requests s.headers.update(headers) 更新headers
- python requests获取网页乱码
- python使用requests获取cookie
- PHP 如果获取接口的值和response headers内容
- python中的requests用法简介
- python中的requests模块错误
- python中的requests模块学习
- python requests库中的代理
- Python中的requests包安装
- python学习:headers和data的获取
- HTTP Response Headers
- Andriod中插入腾讯广告的使用
- 如何用Sketch制作精致的交互原型?
- gulp插件
- Python引用和深、浅复制时的元素地址问题
- 获取两个日期之间工作日天数,去除节假日和双休
- python requests获取response headers中的location
- Windows10下配置CodeBlocks+OpenCV+MinGW
- 高并发下Linux内核参数调整
- 某安全浏览器竟然也被查出高危漏洞?开源安全问题不容忽视
- HDU6138 Fleet of the Eternal Throne
- -bash: lean: command not found
- windows下使用pip安装模块发生“failed with error code 1”的解决方法
- mysql 常用sql语句优化原则
- 大数据平台搭建(hadoop+spark)