Skip to content

Conversation

@yabirgb
Copy link

@yabirgb yabirgb commented Jan 6, 2026

Summary

As stated in https://requests.readthedocs.io/en/latest/user/advanced/#session-objects

if you’re making several requests to the same host, the underlying TCP connection will be reused, which can result in a significant performance increase

This commit adjusts the initialization of the Http class and the configuration to create a session object that will be reused across different calls.

In addition self.requests_session.proxies.update(requests.utils.getproxies()) needs to be called only once so now the function is lighter in what it does.

For the removed test I checked the commit that added it and I believe is not needed as the code behaves different, session is not closed now.

I have checked it against the tests in my project and seems to work properly too.

Related to #162

Checklist

  • Added changelog entry
  • I alphabetized all attributes, parameters, and methods by name in any class file I changed
  • Ran unit tests (python3 -m unittest discover tests/unit)
  • I have linked the JIRA ticket in the summary section
  • I have reviewed the JIRA ticket to ensure all AC's are met
  • I understand that unless this is a Draft PR or has a DO NOT MERGE label, this PR is considered to be in a deploy ready state and can be deployed if merged to main

As stated in https://requests.readthedocs.io/en/latest/user/advanced/#session-objects

> if you’re making several requests to the same host, the underlying TCP connection will be reused, which can result in a significant performance increase

This commit adjusts the initialization of the Http class and the configuration to create
a session object that will be reused across different calls.

In addition `self.requests_session.proxies.update(requests.utils.getproxies())` needs to be called only once
so now the function is lighter in what it does.

For the removed test I checked the commit that added it and I believe is not needed as the code behaves different, session is not closed now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant