I\'m using python requests library with sessions:
def _get_session(self):
if not self.session:
self.session = requests.Session()
return self.sess
I'd like to clarify some stuff here.
What max_poolsize
argument does is limit the number of TCP connections that can be stored in the connection pool simultaneously. Normally, when you want to execute a HTTP requests, requests will try to take a TCP connection from its connection pool. If there are no available connections, requests will create a new TCP connection, and when it is done making a HTTP request, it will try to put it back in the pool (it will not remember whether the connection was taken from the connection pool or not).
The Full
exception being raised in requests code is just an example of a common Python pattern usually paraphrased as it is easier to ask for forgiveness than for permission. It has nothing with dropping TCP connections.