python项目通过使用jenkinsapi远程控制jenkins

jenkinsapi使用的远程连接方法是requests包,requests包又使用了urllib3,urllib3又引用了httplib。

"""
urllib3 - Thread-safe connection pooling and re-using.
"""

requests使用连接池机制,连接池

http的通过设置

Connection:keep-alive

的header头来表明是长连接,通过传输层tcp的长连接实现

短连接会占用较多的端口

socket就是源IP、源端口、协议(scheme)、目的IP、目的端口的五元组

import requests
sess = requests.Session()
adapter = requests.adapters.HTTPAdapter(pool_connections=100, pool_maxsize=100)
sess.mount('http://', adapter)
resp = sess.get("/mypage")
requests常见的一些错误提示有:
  • Failed to establish a new connection:
  • Connection pool is full, discarding connection

The newest version of Requests does in fact keep the TCP connection alive after your request.. If you do want your TCP connections to close, you can just configure the requests to not use keep-alive.

s = requests.session()
s.config['keep_alive'] = False

s.keep_alive = False

requests的默认连接池是10个,每个连接池的最大连接数默认也是10个

https://segmentfault.com/q/1010000000517234

https://www.kawabangga.com/posts/2740

http://blog.oldboyedu.com/tcp-wait/

http://blog.csdn.net/hetaohappy/article/details/51851880

http://www.cnblogs.com/0201zcr/p/4694945.html

http://codewenda.com/%E6%88%91%E5%8F%AF%E4%BB%A5%E6%9B%B4%E6%94%B9python%E7%9A%84%E8%AF%B7%E6%B1%82%E6%A8%A1%E5%9D%97%E7%9A%84%E8%BF%9E%E6%8E%A5%E6%B1%A0%E5%A4%A7%E5%B0%8F%E5%90%97%EF%BC%9F/

http://docs.python-requests.org/zh_CN/latest/user/advanced.html

https://www.villainhr.com/page/2016/07/23/python%E4%B8%AD%E7%9A%84requests

https://www.villainhr.com/page/2016/07/23/python%E4%B8%AD%E7%9A%84requests

http://blog.csdn.net/hzrandd/article/details/74463313

jenkinsapi出现HTTPConnectionPool Max retires exceeded异常的更多相关文章

  1. Python requests 多线程抓取 出现HTTPConnectionPool Max retires exceeded异常

    https://segmentfault.com/q/1010000000517234 -- ::, - oracle - ERROR - data format error:HTTPConnecti ...

  2. 使用threadpool并发测试,报错HTTPConnectionPool Max retires exceeded

    解决方法:和以下答案一致 https://blog.csdn.net/qq_21405949/article/details/79363084 场景: 在做爬虫项目或者是在发送网络请求的时候,一般都会 ...

  3. HTTPConnectionPool(host='xx.xx.xx.xx', port=xx): Max retries exceeded with url:(Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x0000015A25025EB8>...))

    HTTPConnectionPool(host='xx.xx.xx.xx', port=xx): Max retries exceeded with url:(Caused by ConnectTim ...

  4. HTTPConnectionPool(host:XX)Max retries exceeded with url 解决方法

    爬虫多次访问同一个网站一段时间后会出现错误 HTTPConnectionPool(host:XX)Max retries exceeded with url '<requests.package ...

  5. HTTPConnectionPool(host:XX)Max retries exceeded with url

    爬虫多次访问同一个网站一段时间后会出现错误 HTTPConnectionPool(host:XX)Max retries exceeded with url '<requests.package ...

  6. Max retries exceeded with url

    78 Traceback (most recent call last):   File "thread072413.py", line 163, in <module> ...

  7. Max retries exceeded with ur

    requests模块在抓取网页时抛出ConnectionError异常,Max retries exceeded with url 主要搜下 "Caused by <class 'so ...

  8. python requests发起请求,报“Max retries exceeded with url”

    需要高频率重复调用一个接口,偶尔会出现"Max retries exceeded with url" 在使用requests多次访问同一个ip时,尤其是在高频率访问下,http连接 ...

  9. 关于python3.6上传文件时报错:HTTPSConnectionPool(host='***.org', port=443): Max retries exceeded with url: /post (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAIL解决办法

    第一个报错: 最近在练习post请求中上传文件时遇到了一个奇葩事情,两台电脑上写了一模一样的代码,一个运行正常,另一个一片红. 最后了解了一下原因以及解决办法.先记录下关键代码: files = {& ...

随机推荐

  1. 掌握Spark机器学习库-01

    第1章 初识机器学习 在本章中将带领大家概要了解什么是机器学习.机器学习在当前有哪些典型应用.机器学习的核心思想.常用的框架有哪些,该如何进行选型等相关问题. 1-1 导学 1-2 机器学习概述 1- ...

  2. windows ubuntu bcdeditor

    双系统. 先装windows,后装ubuntu12.04 为了避免grub引导,所以安装bcdeditor. 平时使用没有什么不适,可是每次linux升级内核以后,grub列表可能就会消失,自然是不能 ...

  3. vscode配置python环境

    修改 tasks.json 配置文件 找到.vscode文件夹下的tasks.json配置文件,拖进 Visual Studio Code 中进行修改. 也可以直接按Ctrl + Shift + p后 ...

  4. java web 学习笔记 - 表达式语言

    1.表达式语言简介 主要为了简化mvc中 jsp的代码量,方便进行属性的输出.还可以避免进行属性为空等的判断,表达式默认将null设置为"". 表达式语言的一个最大的好处就是,只需 ...

  5. MIUI类ROM如何正确修改dpi

    (以下以MIUI为例) 在miui上,如果通过简单的修改build.prop会导致图标重绘错误,App图标分裂.此时配合一条简单的命令即可实现完美无bug的dpi修改. 1.使用终端模拟器执行su 2 ...

  6. webstorm里直接调用命令行

    写代码写到一半要切换窗口出去敲命令行?webstorm的external tools可以帮你省下一点时间 举例说明,比如我要直接使用npm: ctrl+alt+s打开setting菜单,找到exter ...

  7. 泛型术语:占位类型placeholder

    Here’s a generic version of the same code: struct Stack<Element> { var items = [Element]() mut ...

  8. CREATE CONSTRAINT TRIGGER - 定义一个新的约束触发器

    SYNOPSIS CREATE CONSTRAINT TRIGGER name AFTER events ON tablename constraint attributes FOR EACH ROW ...

  9. jvm中的内存溢出与内存泄露

    内存溢出: 就是我们通常遇到的OutOfMemoryError异常,它俗理解就是内存不够,通常在运行大型程序时发生,当程序所需要的内存远远超出了JVM内存所承受大小,就会报出OutOfMemoryEr ...

  10. Windows文件自删除的两种方法

    可执行模块的自删除技术已经被讨论的很多, 有很多极富创意的思路和想法被提出, 但有些似是而非的方案往往使人误入歧途. 举个例子来说, 很多文章认为下面的一小段代码可以实现自删除:void main(v ...