requests
Installation
SKILL.md
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.