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基础的更多相关文章

  1. 爬虫3 requests基础之下载图片用content(二进制内容)

    res = requests.get('http://soso3.gtimg.cn/sosopic/0/11129365531347748413/640') # print(res.content) ...

  2. 爬虫3 requests基础之 乱码编码问题

    import requests res = requests.get('http://www.quanshuwang.com') res.encoding = 'gbk' print(res.text ...

  3. 爬虫3 requests基础2 代理 证书 重定向 响应时间

    import requests # 代理 # proxy = { # 'http':'http://182.61.29.114.6868' # } # res = requests.get('http ...

  4. 从0开始学爬虫4之requests基础知识

    从0开始学爬虫4之requests基础知识 安装requestspip install requests get请求:可以用浏览器直接访问请求可以携带参数,但是又长度限制请求参数直接放在URL后面 P ...

  5. 爬虫简介、requests 基础用法、urlretrieve()

    1. 爬虫简介 2. requests 基础用法 3. urlretrieve() 1. 爬虫简介 爬虫的定义 网络爬虫(又被称为网页蜘蛛.网络机器人),是一种按照一定的规则,自动地抓取万维网信息的程 ...

  6. Python爬虫之requests

    爬虫之requests 库的基本用法 基本请求: requests库提供了http所有的基本请求方式.例如 r = requests.post("http://httpbin.org/pos ...

  7. 孤荷凌寒自学python第六十七天初步了解Python爬虫初识requests模块

    孤荷凌寒自学python第六十七天初步了解Python爬虫初识requests模块 (完整学习过程屏幕记录视频地址在文末) 从今天起开始正式学习Python的爬虫. 今天已经初步了解了两个主要的模块: ...

  8. Python爬虫(requests模块)

     Requests是唯一的一个非转基因的Python HTTP库,人类可以安全享用. Requests基础学习 使用方法: 1.导入Requests模块: import requests 2.尝试用g ...

  9. 利用简易爬虫完成一道基础CTF题

    利用简易爬虫完成一道基础CTF题 声明:本文主要写给新手,侧重于表现使用爬虫爬取页面并提交数据的大致过程,所以没有对一些东西解释的很详细,比如表单,post,get方法,感兴趣的可以私信或评论给我.如 ...

随机推荐

  1. js的页面传值cookie.session

    jquery的cookie: 读取所有的cookie: document.cookie: 读取单个cookie:$.cookie('cookiename'); 新增cookie: $.cookie(' ...

  2. STM32L476应用开发之二:模拟量数据采集

    采集模拟量数据在一台一起中是必不可少的功能.在本次实验中我们要采集的模拟量值主要包括氧气传感器的输出以及压力变送器的输出. 1硬件设计 我们需要采集数据对精度有一定的要求,而STM32L476自带AD ...

  3. mvn tomcat7:help的14个命令

    D:\2018\code\XXX>mvn tomcat7:help [INFO] Scanning for projects... [INFO] [INFO] ----------------- ...

  4. Spring如何使用JdbcTemplate调用存储过程的三种情况

    注:原文 <Spring如何使用JdbcTemplate调用存储过程的三种情况 > Spring的SimpleJdbcTemplate将存储过程的调用进行了良好的封装,下面列出使用Jdbc ...

  5. Confluence 6 注册单一小工具

    如果你不能订阅一个应用的小工具,你需要将小工具一个一个的添加进来.针对网站不支持小工具订阅和你的应用和你的 Confluence 不能建立信任连接的情况,你就只能这样添加了. 首先你需要获得小工具的 ...

  6. mysql 安装问题三:FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db: Data::Dumper

    解决方法是安装autoconf库,执行命令:yum -y install autoconf 安装完成之后继续执行安装mysql的命令:./scripts/mysql_install_db --user ...

  7. MybatisPlus使用介绍

    创建UserController测试类 package com.cppdy.controller; import org.apache.ibatis.session.RowBounds; import ...

  8. 【supervisor】监控服务

    写了一个ftp服务,用supervisor监控一下 1.先写一个配置文件,路径和名称为/etc/supervisord.conf.d/ftp-server.ini [program:ftp-serve ...

  9. laravel 注入那点事

    public function delete(Group $groupId, Post $postId) { $postId->delete(); return response()->j ...

  10. Vue 导入文件import、路径@和.的区别

    ***import: html文件中,通过script标签引入js文件.而vue中,通过import xxx from xxx路径的方式导入文件,不光可以导入js文件. from前的:“xxx”指的是 ...