I have tested a 'POST' request with both PoolManager and HTTPSConnectionPool. The first one works, the other throw me a :
urllib3.exceptions.MaxRetryError:
HTTPSConnectionPool(host='https://some.url.com', port=443):
Max retries exceeded with url: /some-api (Caused by <class 'socket.gaierror'>:
[Errno -2] Name or service not known)
Here's my code for PoolManager:
import urllib3
HOST = 'https://some.url.com'
PORT = 443
PATH = '/some-api'
xml_request = '<some xml tree/>'
manager = urllib3.PoolManager()
res = manager.request('POST', HOST+PATH, {'req':xml_request})
and for HTTPSConnectonPool:
manager = urllib3.HTTPSConnectionPool(HOST, port=PORT)
res = manager.request('POST', PATH, {'req':xml_request})
https://some.url.com
is not a hostname or IP address, it's a URL. So you're feeding the wrong information to HTTPSConnectionPool
.
Furthermore, PoolManager
and HTTPSConnectionPool
are not at the same abstraction level. PoolManager
manages ConnectionPool
instances for you.