types-python-http-client
raw JSON → 3.3.7.20260408 verified Mon Apr 27 auth: no python
Typing stubs for the python-http-client library, enabling type checking for SendGrid's HTTP client. Current version: 3.3.7.20260408. Released as part of typeshed, updated periodically.
pip install types-python-http-client Common errors
error ModuleNotFoundError: No module named 'types' ↓
cause Trying to import from stubs directly instead of the original library.
fix
Use correct import: from python_http_client import HTTPClient
error TypeError: 'type' object is not subscriptable ↓
cause Using stubs with Python <3.10 that lack certain typing features.
fix
Upgrade to Python >=3.10 or use older stubs.
Warnings
gotcha Stubs are for type checking only. They do not replace the runtime library python-http-client. ↓
fix Install python-http-client separately: pip install python-http-client
breaking Changes in stubs may not match the installed version of python-http-client, leading to type errors. ↓
fix Pin both packages to compatible versions. Check typeshed version against python-http-client version.
Imports
- HTTPClient wrong
from types.python_http_client import HTTPClientcorrectfrom python_http_client import HTTPClient
Quickstart
from python_http_client import HTTPClient
client = HTTPClient(host='https://api.sendgrid.com', request_headers={'Authorization': 'Bearer ' + os.environ.get('SENDGRID_API_KEY', '')})
response = client.get('/v3/mail/send')
print(response.status_code)