Skip to content

Fix timeout type hint in RequestsClient #1537

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

Merged

Conversation

abe-101
Copy link
Contributor

@abe-101 abe-101 commented Jul 11, 2025

Why?

The RequestsClient's __init__ method incorrectly typed the timeout parameter as int. The underlying requests library accepts a float for a total timeout or a (connect_timeout, read_timeout) tuple.

What?

This commit updates the type hint to Union[float, Tuple[float, float]] to accurately reflect the timeout in the requests library.

See Also

https://github.com/psf/requests/blob/91a3eabd3dcc4d7f36dd8249e4777a90ef9b4305/src/requests/sessions.py#L538

The `RequestsClient`'s `__init__` method incorrectly typed the `timeout`
parameter as `int`. The underlying `requests` library accepts a float
for a total timeout or a `(connect_timeout, read_timeout)` tuple.

This commit updates the type hint to `Union[float, Tuple[float, float]]`
to accurately reflect the timeout in the requests library.

https://github.com/psf/requests/blob/91a3eabd3dcc4d7f36dd8249e4777a90ef9b4305/src/requests/sessions.py#L538
@abe-101 abe-101 requested a review from a team as a code owner July 11, 2025 01:44
@abe-101 abe-101 requested review from helenye-stripe and removed request for a team July 11, 2025 01:44
Copy link

cla-assistant bot commented Jul 11, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

cla-assistant bot commented Jul 11, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
Copy link

cla-assistant bot commented Jul 11, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@abe-101
Copy link
Contributor Author

abe-101 commented Jul 11, 2025

Good job bot (@cla-assistant) but why 3 duplicate message?

@helenye-stripe
Copy link
Contributor

@abe-101 Thanks for this change!

@helenye-stripe helenye-stripe merged commit 4c53c6d into stripe:master Jul 11, 2025
14 checks passed
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.

2 participants