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

TwilioHttpClient's timeout type hint is incorrect #630

Closed
byarmis opened this issue Dec 12, 2022 · 1 comment · Fixed by #631
Closed

TwilioHttpClient's timeout type hint is incorrect #630

byarmis opened this issue Dec 12, 2022 · 1 comment · Fixed by #631
Labels
difficulty: easy fix is easy in difficulty status: work in progress Twilio or the community is in the process of implementing type: bug bug in the library

Comments

@byarmis
Copy link
Contributor

byarmis commented Dec 12, 2022

Issue Summary

The type hint in twilio-python/http_client.py 's line 25 is incorrect. Currently, it's an int, but it's passed more-or-less directly to requests.sessions.send which accepts a float

Steps to Reproduce

  1. Import TwilioHttpClient
  2. Specify timeout with a float
  3. Type check (with IDE)
  4. Get error

Code Snippet

http_client = TwilioHttpClient(timeout=3.1)

Exception/Log

Expected type 'int', got 'float' instead

image

Technical details:

  • twilio-python version: twilio-7.15.4
  • python version: 3.10

Mypy does not validate typing in docstrings, but my IDE (PyCharm) at least does

@childish-sambino
Copy link
Contributor

Makes sense will. Take a loot at the PR.

Note that the request interface types this as float:

:param float timeout: Socket/Read timeout for the request

@childish-sambino childish-sambino added type: bug bug in the library status: work in progress Twilio or the community is in the process of implementing difficulty: easy fix is easy in difficulty labels Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: easy fix is easy in difficulty status: work in progress Twilio or the community is in the process of implementing type: bug bug in the library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants