twilio / twilio-python

A Python module for communicating with the Twilio API and generating TwiML.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TwilioHttpClient's timeout type hint is incorrect

byarmis opened this issue · comments

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

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