CuttlePy
A fully typed Python HTTP client built on top of primp - the fastest Python HTTP client with browser impersonation capabilities.
Acknowledgements
This project is powered by the excellent primp library. CuttlePy provides type hints and a more structured interface while utilizing primp's powerful features under the hood.
Features
- Full type hints support for better IDE integration
- All the power of primp with a typed interface
- Browser impersonation capabilities
- Support for all HTTP methods
- Comprehensive response object with typed properties
Installation
pip install cuttlepy
Usage
Making Requests
from cuttlepy import get, CuttleClient
# Using convenience functions
response = get("https://api.example.com/data")
print(response.json())
# Using the client
client = CuttleClient(
impersonate="chrome_131",
timeout=30
)
response = client.get("https://api.example.com/data")
Response Object
The CuttleResponse object provides typed access to response data:
response = get("https://api.example.com/data")
# Access response properties with proper typing
content: bytes = response.content
status_code: int = response.status_code
headers: Dict[str, str] = response.headers
cookies: CookieJar = response.cookies
text: str = response.text
# Parse JSON with proper typing
data: Any = response.json()
HTTP Methods
All standard HTTP methods are supported with full type hints:
from cuttlepy import CuttleClient
client = CuttleClient()
# GET request
response = client.get(
url="https://api.example.com/data",
params={"key": "value"},
headers={"Authorization": "Bearer token"}
)
# POST request with JSON
response = client.post(
url="https://api.example.com/data",
json={"key": "value"}
)
# POST with form data
response = client.post(
url="https://api.example.com/data",
data={"key": "value"}
)
# POST with files
response = client.post(
url="https://api.example.com/data",
files={"file": open("document.pdf", "rb").read()}
)
Authentication
# Basic auth
client = CuttleClient(auth=("username", "password"))
# Bearer token
client = CuttleClient(auth_bearer="your-token")
Browser Impersonation
client = CuttleClient(impersonate="chrome_131")
📖 API Reference
CuttleClient
class CuttleClient:
def __init__(
self,
*,
auth: Optional[Tuple[str, str]] = None,
auth_bearer: Optional[str] = None,
params: Optional[Dict[str, str]] = None,
headers: Optional[Dict[str, str]] = None,
cookies: Optional[Dict[str, str]] = None,
timeout: float = 30,
cookie_store: bool = True,
referer: bool = True,
proxy: Optional[str] = None,
impersonate: Optional[str] = None,
follow_redirects: bool = True,
max_redirects: int = 20,
verify: bool = True,
ca_cert_file: Optional[str] = None,
http1: Optional[bool] = None,
http2: Optional[bool] = None
): ...
CuttleResponse
class CuttleResponse:
@property
def content(self) -> bytes: ...
@property
def cookies(self) -> CookieJar: ...
@property
def encoding(self) -> Optional[str]: ...
@property
def headers(self) -> Dict[str, str]: ...
@property
def status_code(self) -> int: ...
@property
def text(self) -> str: ...
def json(self) -> Any: ...
@property
def url(self) -> str: ...
def raise_for_status(self) -> None: ...
License
MIT License
Links
- primp Documentation - The underlying HTTP client used by CuttlePy
Metadata
Release files for cuttlepy 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cuttlepy-0.2.2.tar.gz | 11.3 kB | Without provenance | Details for cuttlepy-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cuttlepy-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for cuttlepy-0.2.2-py3-none-any.whl |
Total release size: 18.5 kB
Release files / cuttlepy-0.2.2.tar.gz
| Download URL | cuttlepy-0.2.2.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aedeb14fe77e4964117a888a825b564eea497955f2fd315dd1a136e1c8e19b5c
|
|
BLAKE2b-256 checksum How to use checksums |
6028fe61018a69e2f2e1c471732c498bf67cd1a1c1a8b2d99f0e55c50127a0ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.9
|
Release files / cuttlepy-0.2.2-py3-none-any.whl
| Download URL | cuttlepy-0.2.2-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e50d9a2533daec738c9d9dd19a2561339e5b8a5b22ee3a89191b8990bceb6ae
|
|
BLAKE2b-256 checksum How to use checksums |
47a93d6ae01f861f7166579dd1ef2baea86ec80ba8795564be65069c998c8b60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.9
|
Security for cuttlepy 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.