Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allows clients to pass in an HTTP Session #59

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

coessiane
Copy link
Contributor

@coessiane coessiane commented Dec 10, 2024

This pull request introduces changes to the __init__ method of the compass.py module, which is responsible for initializing a compass client to interact with the Compass API. The modifications primarily involve updating the handling of the default_timeout and introducing a new http_session parameter.

Changes:

  • The default_timeout parameter's type hint has been updated from int to int | None, indicating that it can now accept None as a valid value.
  • A new parameter, http_session, has been added to the __init__ method, allowing for the specification of an HTTP session with a custom timeout.
  • The instantiation of the SessionWithDefaultTimeout class has been replaced with a conditional assignment, setting self.session to either the provided http_session or a new instance of requests.Session().
  • A warning message is logged if default_timeout is not None, indicating that the variable is deprecated and will not have any effect. This message also provides guidance on using the http_session parameter for specifying HTTP request timeouts.

@coessiane coessiane requested a review from a team as a code owner December 10, 2024 14:56
@benrules3
Copy link
Contributor

@coessiane I believe @raphael-cohere added this timeout, have you aligned with him on this switch? Otherwise this LGTM.

@coessiane coessiane force-pushed the abel/fix-allows-clients-to-pass-in-an-http-session branch 4 times, most recently from 80eb337 to 3658741 Compare December 10, 2024 17:08
@coessiane coessiane force-pushed the abel/fix-allows-clients-to-pass-in-an-http-session branch from 3658741 to d12292a Compare December 10, 2024 17:09
@coessiane coessiane merged commit 8126e73 into main Dec 10, 2024
11 checks passed
@coessiane coessiane deleted the abel/fix-allows-clients-to-pass-in-an-http-session branch December 10, 2024 17:23
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.

3 participants