urllib3

urllib3 connectionpool – Connection pool is full, discarding connection

urllib3 connectionpool – Connection pool is full, discarding connection Question: Does seeing the urllib3.connectionpool WARNING – Connection pool is full, discarding connection mean that I am effectively loosing data (because of lost connection) OR Does it mean that connection is dropped (because pool is full); however, the same connection will be re-tried later on when …

Total answers: 2

MaxRetryError: HTTPConnectionPool: Max retries exceeded (Caused by ProtocolError('Connection aborted.', error(111, 'Connection refused')))

MaxRetryError: HTTPConnectionPool: Max retries exceeded (Caused by ProtocolError('Connection aborted.', error(111, 'Connection refused'))) Question: I have one question:I want to test "select" and "input".can I write it like the code below: original code: 12 class Sinaselecttest(unittest.TestCase): 13 14 def setUp(self): 15 binary = FirefoxBinary(‘/usr/local/firefox/firefox’) 16 self.driver = webdriver.Firefox(firefox_binary=binary) 17 18 def test_select_in_sina(self): 19 driver = self.driver …

Total answers: 3

urllib3.exceptions.ProtocolError: ('Connection aborted.', error(10054, 'An existing connection was forcibly closed by the remote host'))

urllib3.exceptions.ProtocolError: ('Connection aborted.', error(10054, 'An existing connection was forcibly closed by the remote host')) Question: I am trying to open a website on chrome using Python Selenium chromedriver. Chrome browser is opening (with warnings) and the url is not opening. Version details : Chrome : 68.0.3440.106 selenium : 3.14.0 chromedriver : 2.20 python : 2.7 …

Total answers: 1

Python (pip) – RequestsDependencyWarning: urllib3 (1.9.1) or chardet (2.3.0) doesn't match a supported version

Python (pip) – RequestsDependencyWarning: urllib3 (1.9.1) or chardet (2.3.0) doesn't match a supported version Question: I found several pages about this issue but none of them solved my problem. Even if I do a : pip show I get : /usr/local/lib/python2.7/dist-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.9.1) or chardet (2.3.0) doesn’t match a supported version! RequestsDependencyWarning) Traceback (most …

Total answers: 21

TypeError: can't concat bytes to str python3

TypeError: can't concat bytes to str python3 Question: I’m trying to send HTTP request in python3 using urllib3. Here is code snippet request_body = {‘grant_type’:’password’,’username’: username,’password’: password} request_headers = {‘Content-Type’ : ‘application/x-www-form-urlencoded’,’Authorization’: “hash string”} http = urllib3.PoolManager() response = http.request(‘POST’, ‘https://api/url/endpoint’, headers=request_headers, body=request_body) But when I try to execute it, it throws following error. TypeError: …

Total answers: 3

No module named urllib3

No module named urllib3 Question: I wrote a script to call an API and ran it successfully last week. This week, it won’t run. I get back the following error message: Traceback (most recent call last): File “user_audit.py”, line 2, in <module> import requests File “c:Python27libsite-packagesrequests__init__.py”, line 60, in <module> from .packages.urllib3.exceptions import DependencyWarning File …

Total answers: 9

What's the meaning of pool_connections in requests.adapters.HTTPAdapter?

What's the meaning of pool_connections in requests.adapters.HTTPAdapter? Question: When initializing a requests’ Session, two HTTPAdapter will be created and mount to http and https. This is how HTTPAdapter is defined: class requests.adapters.HTTPAdapter(pool_connections=10, pool_maxsize=10, max_retries=0, pool_block=False) While I understand the meaning of pool_maxsize(which is the number of session a pool can save), I don’t understand what …

Total answers: 3

Suppress InsecureRequestWarning: Unverified HTTPS request is being made in Python2.6

Suppress InsecureRequestWarning: Unverified HTTPS request is being made in Python2.6 Question: I am writing scripts in Python2.6 with use of pyVmomi and while using one of the connection methods: service_instance = connect.SmartConnect(host=args.ip, user=args.user, pwd=args.password) I get the following warning: /usr/lib/python2.6/site-packages/requests/packages/urllib3/connectionpool.py:734: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html …

Total answers: 15

How to retry urllib2.request when fails?

How to retry urllib2.request when fails? Question: When urllib2.request reaches timeout, a urllib2.URLError exception is raised. What is the pythonic way to retry establishing a connection? Asked By: iTayb || Source Answers: I would use a retry decorator. There are other ones out there, but this one works pretty well. Here’s how you can use …

Total answers: 4