
requests
โ Officialโ 2,433by microsoft ยท part of microsoft/debugpy
Best practices for HTTP client usage with Requests including sessions, error handling, and timeouts.
๐ฅ๐ฅ๐ฅ๐ฅโ VerifiedFreeQuick setup
๐งฐ Not standalone. This skill ships with microsoft/debugpy and only works together with that tool โ install the tool first, then add this skill.
This is the playbook your agent receives when the skill activates โ you don't need to read it to use the skill, but it's here to audit before installing.
Skill: Requests
Best practices for HTTP client usage with Requests including sessions, error handling, and timeouts.
When to Use
Apply this skill when making HTTP requests with the Requests library โ sessions, auth, error handling, retries, and file uploads.
Sessions
- Use
requests.Session()for connection pooling and persistent headers/cookies across multiple requests. - Configure
session.headersfor default auth tokens and user-agent strings. - Use
session.mount()withHTTPAdapterfor retry logic.
Error Handling
- Always call
response.raise_for_status()to surface HTTP errors as exceptions. - Always set
timeout=(connect_timeout, read_timeout)โ never use infinite timeouts. - Handle
requests.ConnectionError,requests.Timeout, andrequests.HTTPErrorexplicitly.
Retries
- Use
urllib3.util.RetrywithHTTPAdapterfor automatic retries with backoff. - Configure status-based retries for transient errors (429, 500, 502, 503, 504).
Security
- Never disable SSL verification (
verify=False) in production. - Pass credentials via environment variables, not hardcoded strings.
- Use
auth=parameter for HTTP auth rather than manually setting headers.
Pitfalls
- Don't forget timeouts โ they default to None (infinite wait).
- Don't use
requests.get()for high-throughput โ use sessions. - Close responses from streaming requests (
stream=True) to release connections.
Copy & paste โ that's it
npx skills add microsoft/debugpy --skill "requests" --full-depthRun this in your project โ your agent picks the skill up automatically.
No common issues documented yet. If you hit a problem, the repository's GitHub Issues page is the best place to look.