July 2017
Beginner to intermediate
340 pages
7h 43m
English
Requests use urllib3 under the hood, which will create one pool of connectors per host you are calling and reuse them when the code calls a host.
In other words, if your service calls several other services, you don't need to worry about recycling connections made to those services; requests should handle it for you.
Flask is a synchronous framework, so if you are running with a single thread, which is the default behavior, then the requests library's connection pooling doesn't help you much. Every call will happen one after the other. Requests should only keep one connector open per remote host.
But if you run your Flask application with several threads and have a lot of concurrent connections, these pools can play a vital ...