爬虫3 requests基础
import requests # get实例
# res = requests.get('http://httpbin.org/get')
# # res.encoding='utf-8'
# print(res.encoding) #编码格式
# print(res.text)#获取文本
#####################
#post实例
# info = {
# 'username':'QiuGeiWa',
# 'password':'asdas'
# }
# res = requests.post('http://httpbin.org/post',data=info)
# # print(res.text)
# print(res.url)
######################
#?后面参数实例
info = {
'username':'QiuGeiWa',
'password':'asdas'
}
params ={
'ha':'asd',
'b' : 'sadas'
}
headers = {
'a': "sadas"
}
co = {
'session-id':'' }
res = requests.post('http://httpbin.org/post',
data=info,
params = params,
headers=headers,
cookies = co
)
print(res.url)
# print(res.text)
print(res.request.headers)
print(res.cookies)
爬虫3 requests基础的更多相关文章
- 爬虫3 requests基础之下载图片用content(二进制内容)
res = requests.get('http://soso3.gtimg.cn/sosopic/0/11129365531347748413/640') # print(res.content) ...
- 爬虫3 requests基础之 乱码编码问题
import requests res = requests.get('http://www.quanshuwang.com') res.encoding = 'gbk' print(res.text ...
- 爬虫3 requests基础2 代理 证书 重定向 响应时间
import requests # 代理 # proxy = { # 'http':'http://182.61.29.114.6868' # } # res = requests.get('http ...
- 从0开始学爬虫4之requests基础知识
从0开始学爬虫4之requests基础知识 安装requestspip install requests get请求:可以用浏览器直接访问请求可以携带参数,但是又长度限制请求参数直接放在URL后面 P ...
- 爬虫简介、requests 基础用法、urlretrieve()
1. 爬虫简介 2. requests 基础用法 3. urlretrieve() 1. 爬虫简介 爬虫的定义 网络爬虫(又被称为网页蜘蛛.网络机器人),是一种按照一定的规则,自动地抓取万维网信息的程 ...
- Python爬虫之requests
爬虫之requests 库的基本用法 基本请求: requests库提供了http所有的基本请求方式.例如 r = requests.post("http://httpbin.org/pos ...
- 孤荷凌寒自学python第六十七天初步了解Python爬虫初识requests模块
孤荷凌寒自学python第六十七天初步了解Python爬虫初识requests模块 (完整学习过程屏幕记录视频地址在文末) 从今天起开始正式学习Python的爬虫. 今天已经初步了解了两个主要的模块: ...
- Python爬虫(requests模块)
Requests是唯一的一个非转基因的Python HTTP库,人类可以安全享用. Requests基础学习 使用方法: 1.导入Requests模块: import requests 2.尝试用g ...
- 利用简易爬虫完成一道基础CTF题
利用简易爬虫完成一道基础CTF题 声明:本文主要写给新手,侧重于表现使用爬虫爬取页面并提交数据的大致过程,所以没有对一些东西解释的很详细,比如表单,post,get方法,感兴趣的可以私信或评论给我.如 ...
随机推荐
- html5中如何去掉input type date默认
html5中如何去掉input type date默认样式 2.对日期时间控件的样式进行修改目前WebKit下有如下9个伪元素可以改变日期控件的UI:::-webkit-datetime-edit – ...
- 原来商家登录系统的commonjs
/* *适配 */ //orientationchange方向改变事件 (function (doc,win) { var docEl = doc.documentElement,//根元素html ...
- Windows下Oracle 11g的下载与安装
Windows下Oracle的下载与安装 一.Oracle下载 官网地址:http://www.oracle.com/technetwork/database/enterprise-edition/d ...
- Oracle中如何查询CLOB字段类型的内容
注:本文来源于:<Oracle中如何查询CLOB字段类型的内容> 语法 select * from table_name where dbms_lob.instr(字段名(clod类型), ...
- Ionic 2: ReferenceError: webpackJsonp is not defined
I'm new to Ionic. I have started project with super template. But when I try to run the app in brows ...
- Nginx + tomcat服务器 负载均衡
Nginx 反向代理初印象 Nginx (“engine x”) 是一个高性能的HTTP和反向代理 服务器,也是一个IMAP/POP3/SMTP服务器.其特点是占有内存少,并发能力强,事实上nginx ...
- springboot多环境(dev、test、prod)配置
propertiest配置格式在Spring Boot中多环境配置文件名需要满足application-{profile}.properties的格式,其中{profile}对应你的环境标识,比如: ...
- DoNetZip类库解压和压缩文件
using Ionic.Zip; public class ZipHelper { public static void ZipSingleFile(string zipPath) { try { u ...
- .NoSuchBeanDefinitionException: No bean named 'userService' available
- Java链表和递归
删除链表的指定元素: public class ListNode { public int val; public ListNode next; public ListNode(int x){ val ...