Since the trello.TrelloClient object is typically long-lived and used for multiple calls to the Trello API, using requests.Session instead of requests.request() would allow us to take advantage of connection pooling for better efficiency and fewer round trips. This could potentially increase the performance of the entire library in one go. Default headers like Accept: application/json, API authentication with self.oauth, and proxy settings with self.proxies can be set at the Session level and reused between requests. Since the API for requests.Session is the same as the main requests API, this should be a nearly drop-in change.
Since the
trello.TrelloClient
object is typically long-lived and used for multiple calls to the Trello API, usingrequests.Session
instead ofrequests.request()
would allow us to take advantage of connection pooling for better efficiency and fewer round trips. This could potentially increase the performance of the entire library in one go. Default headers likeAccept: application/json
, API authentication withself.oauth
, and proxy settings withself.proxies
can be set at the Session level and reused between requests. Since the API forrequests.Session
is the same as the main requests API, this should be a nearly drop-in change.