Registry / http-networking / primp

primp

JSON →
library1.2.2pypypi✓ verified 49d ago

Primp is a Python library that provides a fast HTTP client capable of impersonating various web browsers by replicating their headers and TLS/JA3/JA4/HTTP2 fingerprints. It is implemented as a Python binding to the high-performance Rust `rquest` library. The current version is 1.2.2, and the project maintains an active release cadence with frequent updates.

http-networkingweb-framework
pip install primp
Install & Compatibility
Where this runs
tested against v1.3.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 1.68s
py 3.11
✓ —
✓ 1.75s
py 3.12
✓ —
✓ 1.6s
py 3.13
✓ —
✓ 1.6s
py 3.9
4/5 runs
4/5 runs
28MB installed
● package 28MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Client
from primp import Client
Used for synchronous HTTP requests with impersonation.
AsyncClient
from primp import AsyncClient
Used for asynchronous HTTP requests with impersonation.
Impersonate
from primp import Impersonate
Enum for specifying browser profiles for impersonation.

Demonstrates how to create a `Client` with a specified browser impersonation profile and make a synchronous GET request. The example uses a public endpoint to test TLS fingerprinting.

import primp # Initialize a client with a specific browser impersonation profile # Available profiles: chrome_146, safari_26, edge_146, firefox_148, opera_129, etc. # You can also specify an OS: impersonate_os="linux" client = primp.Client(impersonate="chrome_146") # Make a GET request to a TLS fingerprint testing service resp = client.get("https://tls.peet.ws/api/all") # Print the response body (usually JSON content showing TLS/browser details) print(resp.text) # For asynchronous usage: # import asyncio # async def main(): # async with primp.AsyncClient(impersonate="chrome_146") as client: # resp = await client.get("https://tls.peet.ws/api/all") # print(resp.text) # asyncio.run(main())
Debug
Known issues
breakingAs a relatively new library that wraps a Rust core, Primp's API can evolve. Significant updates have been noted in releases (e.g., v1.2.0 introduced new impersonation profiles and HTTP/2 fingerprinting). Always review release notes for potential API changes when upgrading, especially across minor versions.
fix
Consult the project's GitHub releases page or documentation for changes relevant to your version upgrade.
affects: <1.2.2
gotchaFor effective browser impersonation, always specify an `impersonate` profile (e.g., `impersonate='chrome_146'`) and optionally `impersonate_os` when initializing a `Client` or `AsyncClient`. Without these, Primp may behave as a generic HTTP client and might not bypass advanced bot detection mechanisms.
fix
Initialize your client with `primp.Client(impersonate="profile_name", impersonate_os="os_name")` for optimal results.
affects: All versions
gotchaPrimp requires Python 3.10 or newer. Attempting to install or run Primp with older Python versions will result in installation failures or runtime errors due to syntax or dependency incompatibilities.
fix
Upgrade your Python environment to version 3.10 or later.
affects: <3.10
gotchaBeing a Python binding to a Rust library, debugging low-level network issues (e.g., TLS handshakes, specific HTTP/2 frame errors) might occasionally require familiarity with Rust concepts or consulting the documentation of the underlying `rquest` library.
fix
Refer to the `deedy5/primp` GitHub repository and its Rust core documentation for advanced debugging.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'primp'
The 'primp' package is not installed in the Python environment being used, or the environment is not correctly activated.
fix
Install the primp library using pip: `pip install primp`.
ERROR: Failed building wheel for primp
The native Rust component of the 'primp' library could not be compiled. This often occurs due to missing build tools (like the Rust toolchain or C/C++ compilers), or specific environment issues (e.g., on certain ARM-based systems where pre-built wheels might not be available).
fix
Ensure the Rust toolchain is installed (`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`) and Python development headers are present (e.g., `sudo apt-get install python3-dev` on Debian/Ubuntu, `sudo yum install python3-devel` on CentOS/RHEL, or `brew install python` on macOS). Then, retry the installation.
AttributeError: 'Client' object has no attribute 'some_invalid_method'
An attempt was made to call a method that does not exist on the `primp.Client` (or `primp.AsyncClient`) object. This typically happens due to typos in method names or misunderstanding the library's API.
fix
Consult the `primp` documentation or examples to verify the correct method names and their usage (e.g., `client.get()`, `client.post()`, `resp.text`, `resp.json()`).
ValueError: invalid impersonate profile: 'some_unsupported_profile'
An invalid or misspelled browser impersonation profile name was provided to the `primp.Client` or `primp.AsyncClient` constructor's `impersonate` argument.
fix
Use one of the supported impersonation profile strings as listed in the `primp` documentation (e.g., 'chrome_146', 'firefox_148', 'safari_26.3', 'edge', 'random'). Ensure correct casing and spelling.
Upgrade
Version history
1.3.1latest on PyPI
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
6
seranking-bot
4
ahrefsbot
3
bytedance
2
googlebot
2
bingbot
1
amazonbot
1
Resources