Skip to content

Fix timeout type hint in RequestsClient#1537

Merged
helenye-stripe merged 1 commit into
stripe:masterfrom
abe-101:abe-101/fix-requests-client-timeout-type
Jul 11, 2025
Merged

Fix timeout type hint in RequestsClient#1537
helenye-stripe merged 1 commit into
stripe:masterfrom
abe-101:abe-101/fix-requests-client-timeout-type

Conversation

@abe-101

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

Copy link
Copy Markdown
Contributor

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
@cla-assistant

cla-assistant Bot commented Jul 11, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cla-assistant

cla-assistant Bot commented Jul 11, 2025

Copy link
Copy Markdown

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
@cla-assistant

cla-assistant Bot commented Jul 11, 2025

Copy link
Copy Markdown

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

abe-101 commented Jul 11, 2025

Copy link
Copy Markdown
Contributor Author

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

@helenye-stripe

Copy link
Copy Markdown
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