python3爬虫post请求
来源:互联网 发布:redis与mysql区别 编辑:程序博客网 时间:2024/05/16 18:55
python3
import urllib.request
from bs4 import BeautifulSoup
url=’http://zzk.cnblogs.com/s/blogpost?Keywords=python’
定义一个字典 作为header
send_header={
‘Accept’:’text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8’,
‘Accept-Encoding’:’gzip, deflate, sdch’,
‘Accept-Language’:’zh-CN,zh;q=0.8’,
‘Connection’:’keep-alive’,
‘Cookie’:’__utma=59123430.1728851006.1499049847.1501827480.1501827480.1; __utmc=59123430; __utmz=59123430.1501827480.1.1.utmcsr=cnblogs.com|utmccn=(referral)|utmcmd=referral|utmcct=/; _ga=GA1.2.1728851006.1499049847; _gid=GA1.2.1963339392.1501827475; _gat=1’,
‘Host’:’zzk.cnblogs.com’,
‘Referer’:’http://zzk.cnblogs.com/s?t=b&w=python‘,
‘Upgrade-Insecure-Requests’:’1’,
‘User-Agent’:’Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36’
}
将heaer同步到url上
req=urllib.request.Request(url,headers=send_header)
发起请求
r=urllib.request.urlopen(req)
接收结果
s=r.read()
BeautifulSoup解析
soup=BeautifulSoup(s,’html.parser’)
print(soup.title)
- python3爬虫post请求
- python3爬虫get请求
- Python3 post请求
- python3 网络爬虫(三)利用post请求获取网页的动态加载数据
- Golang爬虫基础:POST请求
- python爬虫之post请求
- Python3 爬虫--网页get和post
- Python3发送post请求,自动记住cookie
- pathon爬虫(三)之post请求
- Python爬虫的post请求简单实例
- python3网络爬虫一《使用urllib.request发送请求》
- python3 爬虫
- python3爬虫
- python3 爬虫
- Python3 爬虫
- python3.x上post发送json内容的请求
- django 实现web接口 python3模拟Post请求
- python3爬虫问题 POST data should be bytes or an iterable of bytes
- js语言精粹读书笔记
- Linux系统调用的实现机制分析
- Spring(15)——基于注解的支持(二)
- 数据结构实验之二叉树的建立与遍历(万能了,水)
- 队列——顺序存储与链式存储
- python3爬虫post请求
- day20(IO流)
- Spring-Cloud学习之路-简单的Eureka
- 《Unix环境高级编程》学习笔记--文件和目录-1
- 剑指Offer——知识点储备-JVM基础
- OCJP认证该不该考?
- Android MVC模式你真的明白了吗??
- 我所理解的实例方法、类方法(@classmethod)和静态方法(@staticmethod)(关键词:实例方法/类方法/@classmethod/静态方法/@staticmethod)
- JavaScript-DOM扩展