urllib3是一个功能强大、条理清晰、用于http客户端的python库,相对于urllib它所有的特点如下:

    线程安全

    连接池

    客户端SSL/TLS验证

    使用多部分编码上传文件

    Helpers用于重试请求并处理HTTP重定向

    支持gzip和deflate编码

    支持HTTP和SOCKS代理

    100%的测试覆盖率

通过urllib3模块实现发送网络请求的示例代码如下:

import urllib3

#创建PoolManager对象,用于处理与线程池得到连接以及线程安全的所有细节
http=urllib3.PoolManager()
#对需要爬取的网页发送请求
response=http.request('GET','https://www.baidu.com/')
print(response.data)

post请求实现获取网页信息的代码:

import urllib3

http=urllib3.PoolManager()

response=http.request('POST','https://httpbin.org/post',fields={'word':'hello'})

print(response.data)

urllib3的更多相关文章

  1. python中urllib, urllib2,urllib3, httplib,httplib2, request的区别

    permike原文python中urllib, urllib2,urllib3, httplib,httplib2, request的区别 若只使用python3.X, 下面可以不看了, 记住有个ur ...

  2. urllib3 ProxyManager

    ProxyManager is an HTTP proxy-aware subclass of PoolManager. It produces a singleHTTPConnectionPool ...

  3. urllib3 PoolManager

    A pool manager is an abstraction for a collection of ConnectionPools.If you need to make requests to ...

  4. urllib3 ConnectionPools

    A connection pool is a container for a collection of connections to a specific host.If you need to m ...

  5. A taste of urllib3

    import urllib3 import certifi http = urllib3.PoolManager( cert_reqs='CERT_REQUIRED', # Force certifi ...

  6. python urllib和urllib3包使用

    urllib包 urllib是一个包含几个模块来处理请求的库.分别是: urllib.request 发送http请求 urllib.error 处理请求过程中,出现的异常. urllib.parse ...

  7. Uiautomator--出现报错“urllib3.exceptions.ProtocolError:<'Connection aborted.',error<10054,''>>”的解决方式!

    在运行uiautomator时,出现报错"urllib3.exceptions.ProtocolError:<'Connection aborted.',error<10054, ...

  8. 禁用 urllib3 的安全请求警告

    报错情况: 禁用该警告: import urllib3 urllib3.disable_warnings()

  9. /usr/lib/python2.7/site-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.22) or chardet (2.2.1) doesn't match a supported version! RequestsDependencyWarning)

    [root@iZwz9bhan5nqzh979qokrkZ ~]# ansible all -m ping /usr/lib/python2.7/site-packages/requests/__in ...

  10. urllib、urllib2、urllib3区别和使用

    python3中把urllib和urllib合并为一个库了,urllib对应urllib.request 1.) python 中最早内置拥有的网络请求模块就是 urllib,我们可以看一下 urll ...

随机推荐

  1. Redis 教程 Java工程师学习知识点

    1. Redis简介及安装 1.1 Redis 简介 Redis 是完全开源免费的,遵守BSD协议,是一个高性能的key-value数据库. Redis 与其他 key - value 缓存产品有以下 ...

  2. Palindromic Matrix

    Palindromic Matrix time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  3. Spring-Boot自动装载servlet

    Spring-Boot自动装载servlet 本人spring-boot相关博客均自己手动编写,但技术均从简书 恒宇少年 处学习,该大佬一直是我的偶像,鉴于能充分理解,所以已做笔记的方式留下这些文档, ...

  4. oracle索引分类

    参考文档:https://wenku.baidu.com/view/d4d6ee1ba76e58fafab00336.html https://blog.csdn.net/u010719917/art ...

  5. 构建一个可以统计 qps 的nginx服务的Dockerfile

    github 项目地址: https://github.com/SilentCC/nginx_lua_qps_count nginx 是经常会用到的web 服务器,它有出色的并发性能,因此尝尝被用来当 ...

  6. c++stack容器介绍

    c++stack(堆栈)是一个容器的改编,它实现了一个先进后出的数据结构(FILO) 使用该容器时需要包含#include<stack>头文件: 定义stack对象的示例代码如下: sta ...

  7. ADC裸机程序

    硬件平台:JZ2440 实现功能:通过采集触摸屏ADC的电压值,推算触摸xy坐标 start.s init.c nand.c interrupt.c uart.c uart.h my_stdio.c ...

  8. python字符串拼接

    Python字符串拼接 在Python的实际开发中,很多都需要用到字符串拼接,python中字符串拼接有很多,今天总结一下: 用+符号拼接 用%符号拼接 用join()方法拼接 用format()方法 ...

  9. SpringCloud微服务高级

    分布式配置中心 什么是配置中心 在分布式系统中,由于服务数量巨多,为了方便服务配置文件统一管理,实时更新,所以需要分布式配置中心组件.在Spring Cloud中,有分布式配置中心组件spring c ...

  10. webstorm项目的structure

    https://www.jetbrains.com/help/webstorm/2016.1/symbols.html