httpxlisted
Install: claude install-skill aiskillstore/marketplace
# HTTPX Skill
HTTPX is a fully featured HTTP client for Python that provides both synchronous and asynchronous APIs, with support for HTTP/1.1 and HTTP/2.
## Quick Start
### Basic Usage
```python
import httpx
# Simple GET request
response = httpx.get('https://api.example.com/data')
print(response.status_code)
print(response.json())
# POST request with JSON data
response = httpx.post('https://api.example.com/users', json={'name': 'Alice'})
```
### Async Usage
```python
import asyncio
import httpx
async def fetch_data():
async with httpx.AsyncClient() as client:
response = await client.get('https://api.example.com/data')
return response.json()
result = asyncio.run(fetch_data())
```
## Common Patterns
### 1. Async Client with Connection Pooling
```python
import httpx
async def make_multiple_requests():
async with httpx.AsyncClient() as client:
# Reuse the same client for multiple requests
tasks = [
client.get('https://api.example.com/users/1'),
client.get('https://api.example.com/users/2'),
client.get('https://api.example.com/users/3')
]
responses = await asyncio.gather(*tasks)
return [r.json() for r in responses]
```
### 2. Authentication
```python
import httpx
# Basic Authentication
auth = httpx.BasicAuth(username='user', password='pass')
client = httpx.Client(auth=auth)
# Bearer Token Authentication
headers = {'Authorization': 'Bearer your-token-here'}
client