Name | primp JSON |
Version |
0.12.1
JSON |
| download |
home_page | None |
Summary | HTTP client that can impersonate web browsers, mimicking their headers and `TLS/JA3/JA4/HTTP2` fingerprints |
upload_time | 2025-02-11 12:42:58 |
maintainer | None |
docs_url | None |
author | deedy5 |
requires_python | >=3.8 |
license | MIT License |
keywords |
python
request
impersonate
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
 [](https://github.com/deedy5/pyreqwest-impersonate/releases) [](https://pypi.org/project/primp) [](https://pepy.tech/project/primp) [](https://github.com/deedy5/pyreqwest-impersonate/actions/workflows/CI.yml)
# 🪞PRIMP
**🪞PRIMP** = **P**ython **R**equests **IMP**ersonate
The fastest python HTTP client that can impersonate web browsers.</br>
Provides precompiled wheels:</br>
* 🐧 linux: `amd64`, `aarch64`, `armv7` (⚠️aarch64 and armv7 builds are `manylinux_2_34` compatible - `ubuntu>=22.04`, `debian>=12`);</br>
* 🐧 musllinux: `amd64`, `aarch64`;</br>
* 🪟 windows: `amd64`;</br>
* 🍏 macos: `amd64`, `aarch64`.</br>
## Table of Contents
- [Installation](#installation)
- [Benchmark](#benchmark)
- [Usage](#usage)
- [I. Client](#i-client)
- [Client methods](#client-methods)
- [Response object](#response-object)
- [Devices](#devices)
- [Examples](#examples)
- [II. AsyncClient](#ii-asyncclient)
## Installation
```python
pip install -U primp
```
## Benchmark

## Usage
### I. Client
HTTP client that can impersonate web browsers.
```python
class Client:
"""Initializes an HTTP client that can impersonate web browsers.
Args:
auth (tuple[str, str| None] | None): Username and password for basic authentication. Default is None.
auth_bearer (str | None): Bearer token for authentication. Default is None.
params (dict[str, str] | None): Default query parameters to include in all requests. Default is None.
headers (dict[str, str] | None): Default headers to send with requests. If `impersonate` is set, this will be ignored.
cookies (dict[str, str] | None): - Map of cookies to send with requests as the `Cookie` header.
timeout (float | None): HTTP request timeout in seconds. Default is 30.
cookie_store (bool | None): Enable a persistent cookie store. Received cookies will be preserved and included
in additional requests. Default is True.
referer (bool | None): Enable or disable automatic setting of the `Referer` header. Default is True.
proxy (str | None): Proxy URL for HTTP requests. Example: "socks5://127.0.0.1:9150". Default is None.
impersonate (str | None): Entity to impersonate. Example: "chrome_124". Default is None.
Chrome: "chrome_100","chrome_101","chrome_104","chrome_105","chrome_106","chrome_107","chrome_108",
"chrome_109","chrome_114","chrome_116","chrome_117","chrome_118","chrome_119","chrome_120",
"chrome_123","chrome_124","chrome_126","chrome_127","chrome_128","chrome_129","chrome_130",
"chrome_131"
Safari: "safari_ios_16.5","safari_ios_17.2","safari_ios_17.4.1","safari_ios_18.1.1",
"safari_15.3","safari_15.5","safari_15.6.1","safari_16","safari_16.5","safari_17.0",
"safari_17.2.1","safari_17.4.1","safari_17.5","safari_18","safari_18.2","safari_ipad_18"
OkHttp: "okhttp_3.9","okhttp_3.11","okhttp_3.13","okhttp_3.14","okhttp_4.9","okhttp_4.10","okhttp_5"
Edge: "edge_101","edge_122","edge_127","edge_131"
Firefox: "firefox_109","firefox_117","firefox_128","firefox_133"
impersonate_os (str | None): impersonate OS. Example: "windows". Default is "linux".
Android: "android", iOS: "ios", Linux: "linux", Mac OS: "macos", Windows: "windows"
follow_redirects (bool | None): Whether to follow redirects. Default is True.
max_redirects (int | None): Maximum redirects to follow. Default 20. Applies if `follow_redirects` is True.
verify (bool | None): Verify SSL certificates. Default is True.
ca_cert_file (str | None): Path to CA certificate store. Default is None.
https_only` (bool | None): Restrict the Client to be used with HTTPS only requests. Default is `false`.
http2_only` (bool | None): If true - use only HTTP/2; if false - use only HTTP/1. Default is `false`.
"""
```
#### Client methods
The `Client` class provides a set of methods for making HTTP requests: `get`, `head`, `options`, `delete`, `post`, `put`, `patch`, each of which internally utilizes the `request()` method for execution. The parameters for these methods closely resemble those in `httpx`.
```python
def get(
url: str,
params: dict[str, str] | None = None,
headers: dict[str, str] | None = None,
cookies: dict[str, str] | None = None,
auth: tuple[str, str| None] | None = None,
auth_bearer: str | None = None,
timeout: float | None = 30,
):
"""Performs a GET request to the specified URL.
Args:
url (str): The URL to which the request will be made.
params (dict[str, str] | None): A map of query parameters to append to the URL. Default is None.
headers (dict[str, str] | None): A map of HTTP headers to send with the request. Default is None.
cookies (dict[str, str] | None): - An optional map of cookies to send with requests as the `Cookie` header.
auth (tuple[str, str| None] | None): A tuple containing the username and an optional password
for basic authentication. Default is None.
auth_bearer (str | None): A string representing the bearer token for bearer token authentication. Default is None.
timeout (float | None): The timeout for the request in seconds. Default is 30.
"""
```
```python
def post(
url: str,
params: dict[str, str] | None = None,
headers: dict[str, str] | None = None,
cookies: dict[str, str] | None = None,
content: bytes | None = None,
data: dict[str, Any] | None = None,
json: Any | None = None,
files: dict[str, str] | None = None,
auth: tuple[str, str| None] | None = None,
auth_bearer: str | None = None,
timeout: float | None = 30,
):
"""Performs a POST request to the specified URL.
Args:
url (str): The URL to which the request will be made.
params (dict[str, str] | None): A map of query parameters to append to the URL. Default is None.
headers (dict[str, str] | None): A map of HTTP headers to send with the request. Default is None.
cookies (dict[str, str] | None): - An optional map of cookies to send with requests as the `Cookie` header.
content (bytes | None): The content to send in the request body as bytes. Default is None.
data (dict[str, Any] | None): The form data to send in the request body. Default is None.
json (Any | None): A JSON serializable object to send in the request body. Default is None.
files (dict[str, str] | None): A map of file fields to file paths to be sent as multipart/form-data. Default is None.
auth (tuple[str, str| None] | None): A tuple containing the username and an optional password
for basic authentication. Default is None.
auth_bearer (str | None): A string representing the bearer token for bearer token authentication. Default is None.
timeout (float | None): The timeout for the request in seconds. Default is 30.
"""
```
#### Response object
```python
resp.content
resp.cookies
resp.encoding
resp.headers
resp.json()
resp.status_code
resp.text
resp.text_markdown # html is converted to markdown text
resp.text_plain # html is converted to plain text
resp.text_rich # html is converted to rich text
resp.url
```
#### Devices
##### Impersonate
- Chrome: `chrome_100`,`chrome_101`,`chrome_104`,`chrome_105`,`chrome_106`,`chrome_107`,`chrome_108`,`chrome_109`,`chrome_114`,`chrome_116`,`chrome_117`,`chrome_118`,`chrome_119`,`chrome_120`,`chrome_123`,`chrome_124`,`chrome_126`,`chrome_127`,`chrome_128`,`chrome_129`,`chrome_130`,`chrome_131`
- Edge: `edge_101`,`edge_122`,`edge_127`, `edge_131`
- Safari: `safari_ios_17.2`,`safari_ios_17.4.1`,`safari_ios_16.5`,`safari_ios_18.1.1`, `safari_15.3`,`safari_15.5`,`safari_15.6.1`,`safari_16`,`safari_16.5`,`safari_17.0`,`safari_17.2.1`,`safari_17.4.1`,`safari_17.5`,`safari_18`,`safari_18.2`, `safari_ipad_18`
- OkHttp: `okhttp_3.9`,`okhttp_3.11`,`okhttp_3.13`,`okhttp_3.14`,`okhttp_4.9`,`okhttp_4.10`,`okhttp_5`
- Firefox: `firefox_109`, `firefox_117`, `firefox_128`, `firefox_133`
##### Impersonate OS
- Android: `android`
- iOS: `ios`
- Linux: `linux`
- Mac OS: `macos`
- Windows: `windows`
#### Examples
```python
import primp
# Impersonate
client = primp.Client(impersonate="chrome_131", impersonate_os="windows") # chrome_131 + windows
# GET request
resp = client.get("https://tls.peet.ws/api/all")
print(resp.json())
# GET request with passing params and setting timeout
params = {"param1": "value1", "param2": "value2"}
resp = client.post(url="https://httpbin.org/anything", params=params, timeout=10)
print(r.text)
# POST Binary Request Data
content = b"some_data"
resp = client.post(url="https://httpbin.org/anything", content=content)
print(r.text)
# POST Form Encoded Data
data = {"key1": "value1", "key2": "value2"}
resp = client.post(url="https://httpbin.org/anything", data=data)
print(r.text)
# POST JSON Encoded Data
json = {"key1": "value1", "key2": "value2"}
resp = client.post(url="https://httpbin.org/anything", json=json)
print(r.text)
# POST Multipart-Encoded Files
files = {'file1': '/home/root/file1.txt', 'file2': 'home/root/file2.txt'}
r = client.post("https://httpbin.org/post", files=files)
print(r.text)
# Authentication using user/password
auth = ("user", "password")
resp = client.post(url="https://httpbin.org/anything", auth=auth)
print(r.text)
# Authentication using auth bearer
auth_bearer = "bearerXXXXXXXXXXXXXXXXXXXX"
resp = client.post(url="https://httpbin.org/anything", auth_bearer=auth_bearer)
print(r.text)
# Using proxy or env var PRIMP_PROXY
resp = primp.Client(proxy="http://127.0.0.1:8080").get("https://tls.peet.ws/api/all")
print(resp.json())
export PRIMP_PROXY="socks5://127.0.0.1:1080"
resp = primp.Client().get("https://tls.peet.ws/api/all")
print(resp.json())
# Using custom CA certificate store: env var PRIMP_CA_BUNDLE
#(Primp built with the Mozilla's latest trusted root certificates, so maybe it's not necessary)
resp = primp.Client(ca_cert_file="/cert/cacert.pem").get("https://tls.peet.ws/api/all")
print(resp.json())
resp = primp.Client(ca_cert_file=certifi.where()).get("https://tls.peet.ws/api/all")
print(resp.json())
export PRIMP_CA_BUNDLE="/home/user/Downloads/cert.pem"
resp = primp.Client().get("https://tls.peet.ws/api/all")
print(resp.json())
# You can also use convenience functions that use a default Client instance under the hood:
# primp.get() | primp.head() | primp.options() | primp.delete() | primp.post() | primp.patch() | primp.put()
# These functions can accept the `impersonate` parameter:
resp = primp.get("https://httpbin.org/anything", impersonate="chrome_131", impersonate_os="android")
print(r.text)
```
### II. AsyncClient
`primp.AsyncClient()` is an asynchronous wrapper around the `primp.Client` class, offering the same functions, behavior, and input arguments.
```python3
import asyncio
import logging
import primp
async def aget_text(url):
async with primp.AsyncClient(impersonate="chrome_131") as client:
resp = await client.get(url)
return resp.text
async def main():
urls = ["https://nytimes.com/", "https://cnn.com/", "https://abcnews.go.com/"]
tasks = [aget_text(u) for u in urls]
results = await asyncio.gather(*tasks)
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
asyncio.run(main())
```
Raw data
{
"_id": null,
"home_page": null,
"name": "primp",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "python, request, impersonate",
"author": "deedy5",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/98/e1/16de42a8f1763e957a957c5ebfdbab7eb6a870f43608bc47c912f6196136/primp-0.12.1.tar.gz",
"platform": null,
"description": " [](https://github.com/deedy5/pyreqwest-impersonate/releases) [](https://pypi.org/project/primp) [](https://pepy.tech/project/primp) [](https://github.com/deedy5/pyreqwest-impersonate/actions/workflows/CI.yml)\n# \ud83e\ude9ePRIMP\n**\ud83e\ude9ePRIMP** = **P**ython **R**equests **IMP**ersonate\n\nThe fastest python HTTP client that can impersonate web browsers.</br>\nProvides precompiled wheels:</br>\n * \ud83d\udc27 linux: `amd64`, `aarch64`, `armv7` (\u26a0\ufe0faarch64 and armv7 builds are `manylinux_2_34` compatible - `ubuntu>=22.04`, `debian>=12`);</br>\n * \ud83d\udc27 musllinux: `amd64`, `aarch64`;</br>\n * \ud83e\ude9f windows: `amd64`;</br>\n * \ud83c\udf4f macos: `amd64`, `aarch64`.</br>\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Benchmark](#benchmark)\n- [Usage](#usage)\n - [I. Client](#i-client)\n - [Client methods](#client-methods)\n - [Response object](#response-object)\n - [Devices](#devices)\n - [Examples](#examples)\n - [II. AsyncClient](#ii-asyncclient)\n\n## Installation\n\n```python\npip install -U primp\n```\n\n## Benchmark\n\n\n\n## Usage\n### I. Client\n\nHTTP client that can impersonate web browsers.\n```python\nclass Client:\n \"\"\"Initializes an HTTP client that can impersonate web browsers.\n\n Args:\n auth (tuple[str, str| None] | None): Username and password for basic authentication. Default is None.\n auth_bearer (str | None): Bearer token for authentication. Default is None.\n params (dict[str, str] | None): Default query parameters to include in all requests. Default is None.\n headers (dict[str, str] | None): Default headers to send with requests. If `impersonate` is set, this will be ignored.\n cookies (dict[str, str] | None): - Map of cookies to send with requests as the `Cookie` header.\n timeout (float | None): HTTP request timeout in seconds. Default is 30.\n cookie_store (bool | None): Enable a persistent cookie store. Received cookies will be preserved and included\n in additional requests. Default is True.\n referer (bool | None): Enable or disable automatic setting of the `Referer` header. Default is True.\n proxy (str | None): Proxy URL for HTTP requests. Example: \"socks5://127.0.0.1:9150\". Default is None.\n impersonate (str | None): Entity to impersonate. Example: \"chrome_124\". Default is None.\n Chrome: \"chrome_100\",\"chrome_101\",\"chrome_104\",\"chrome_105\",\"chrome_106\",\"chrome_107\",\"chrome_108\",\n \"chrome_109\",\"chrome_114\",\"chrome_116\",\"chrome_117\",\"chrome_118\",\"chrome_119\",\"chrome_120\",\n \"chrome_123\",\"chrome_124\",\"chrome_126\",\"chrome_127\",\"chrome_128\",\"chrome_129\",\"chrome_130\",\n \"chrome_131\"\n Safari: \"safari_ios_16.5\",\"safari_ios_17.2\",\"safari_ios_17.4.1\",\"safari_ios_18.1.1\",\n \"safari_15.3\",\"safari_15.5\",\"safari_15.6.1\",\"safari_16\",\"safari_16.5\",\"safari_17.0\",\n \"safari_17.2.1\",\"safari_17.4.1\",\"safari_17.5\",\"safari_18\",\"safari_18.2\",\"safari_ipad_18\"\n OkHttp: \"okhttp_3.9\",\"okhttp_3.11\",\"okhttp_3.13\",\"okhttp_3.14\",\"okhttp_4.9\",\"okhttp_4.10\",\"okhttp_5\"\n Edge: \"edge_101\",\"edge_122\",\"edge_127\",\"edge_131\"\n Firefox: \"firefox_109\",\"firefox_117\",\"firefox_128\",\"firefox_133\"\n impersonate_os (str | None): impersonate OS. Example: \"windows\". Default is \"linux\".\n Android: \"android\", iOS: \"ios\", Linux: \"linux\", Mac OS: \"macos\", Windows: \"windows\"\n follow_redirects (bool | None): Whether to follow redirects. Default is True.\n max_redirects (int | None): Maximum redirects to follow. Default 20. Applies if `follow_redirects` is True.\n verify (bool | None): Verify SSL certificates. Default is True.\n ca_cert_file (str | None): Path to CA certificate store. Default is None.\n https_only` (bool | None): Restrict the Client to be used with HTTPS only requests. Default is `false`.\n http2_only` (bool | None): If true - use only HTTP/2; if false - use only HTTP/1. Default is `false`.\n\n \"\"\"\n```\n\n#### Client methods\n\nThe `Client` class provides a set of methods for making HTTP requests: `get`, `head`, `options`, `delete`, `post`, `put`, `patch`, each of which internally utilizes the `request()` method for execution. The parameters for these methods closely resemble those in `httpx`.\n```python\ndef get(\n url: str,\n params: dict[str, str] | None = None,\n headers: dict[str, str] | None = None,\n cookies: dict[str, str] | None = None,\n auth: tuple[str, str| None] | None = None,\n auth_bearer: str | None = None,\n timeout: float | None = 30,\n):\n \"\"\"Performs a GET request to the specified URL.\n\n Args:\n url (str): The URL to which the request will be made.\n params (dict[str, str] | None): A map of query parameters to append to the URL. Default is None.\n headers (dict[str, str] | None): A map of HTTP headers to send with the request. Default is None.\n cookies (dict[str, str] | None): - An optional map of cookies to send with requests as the `Cookie` header.\n auth (tuple[str, str| None] | None): A tuple containing the username and an optional password\n for basic authentication. Default is None.\n auth_bearer (str | None): A string representing the bearer token for bearer token authentication. Default is None.\n timeout (float | None): The timeout for the request in seconds. Default is 30.\n\n \"\"\"\n```\n```python\ndef post(\n url: str,\n params: dict[str, str] | None = None,\n headers: dict[str, str] | None = None,\n cookies: dict[str, str] | None = None,\n content: bytes | None = None,\n data: dict[str, Any] | None = None,\n json: Any | None = None,\n files: dict[str, str] | None = None,\n auth: tuple[str, str| None] | None = None,\n auth_bearer: str | None = None,\n timeout: float | None = 30,\n):\n \"\"\"Performs a POST request to the specified URL.\n\n Args:\n url (str): The URL to which the request will be made.\n params (dict[str, str] | None): A map of query parameters to append to the URL. Default is None.\n headers (dict[str, str] | None): A map of HTTP headers to send with the request. Default is None.\n cookies (dict[str, str] | None): - An optional map of cookies to send with requests as the `Cookie` header.\n content (bytes | None): The content to send in the request body as bytes. Default is None.\n data (dict[str, Any] | None): The form data to send in the request body. Default is None.\n json (Any | None): A JSON serializable object to send in the request body. Default is None.\n files (dict[str, str] | None): A map of file fields to file paths to be sent as multipart/form-data. Default is None.\n auth (tuple[str, str| None] | None): A tuple containing the username and an optional password\n for basic authentication. Default is None.\n auth_bearer (str | None): A string representing the bearer token for bearer token authentication. Default is None.\n timeout (float | None): The timeout for the request in seconds. Default is 30.\n\n \"\"\"\n```\n#### Response object\n```python\nresp.content\nresp.cookies\nresp.encoding\nresp.headers\nresp.json()\nresp.status_code\nresp.text\nresp.text_markdown # html is converted to markdown text\nresp.text_plain # html is converted to plain text\nresp.text_rich # html is converted to rich text\nresp.url\n```\n\n#### Devices\n\n##### Impersonate\n\n- Chrome: `chrome_100`\uff0c`chrome_101`\uff0c`chrome_104`\uff0c`chrome_105`\uff0c`chrome_106`\uff0c`chrome_107`\uff0c`chrome_108`\uff0c`chrome_109`\uff0c`chrome_114`\uff0c`chrome_116`\uff0c`chrome_117`\uff0c`chrome_118`\uff0c`chrome_119`\uff0c`chrome_120`\uff0c`chrome_123`\uff0c`chrome_124`\uff0c`chrome_126`\uff0c`chrome_127`\uff0c`chrome_128`\uff0c`chrome_129`\uff0c`chrome_130`\uff0c`chrome_131`\n\n- Edge: `edge_101`\uff0c`edge_122`\uff0c`edge_127`, `edge_131`\n\n- Safari: `safari_ios_17.2`\uff0c`safari_ios_17.4.1`\uff0c`safari_ios_16.5`\uff0c`safari_ios_18.1.1`, `safari_15.3`\uff0c`safari_15.5`\uff0c`safari_15.6.1`\uff0c`safari_16`\uff0c`safari_16.5`\uff0c`safari_17.0`\uff0c`safari_17.2.1`\uff0c`safari_17.4.1`\uff0c`safari_17.5`\uff0c`safari_18`\uff0c`safari_18.2`, `safari_ipad_18`\n\n- OkHttp: `okhttp_3.9`\uff0c`okhttp_3.11`\uff0c`okhttp_3.13`\uff0c`okhttp_3.14`\uff0c`okhttp_4.9`\uff0c`okhttp_4.10`\uff0c`okhttp_5`\n\n- Firefox: `firefox_109`, `firefox_117`, `firefox_128`, `firefox_133`\n\n##### Impersonate OS\n\n- Android: `android`\n\n- iOS: `ios`\n\n- Linux: `linux`\n\n- Mac OS: `macos`\n\n- Windows: `windows`\n\n#### Examples\n\n```python\nimport primp\n\n# Impersonate\nclient = primp.Client(impersonate=\"chrome_131\", impersonate_os=\"windows\") # chrome_131 + windows\n\n# GET request\nresp = client.get(\"https://tls.peet.ws/api/all\")\nprint(resp.json())\n\n# GET request with passing params and setting timeout\nparams = {\"param1\": \"value1\", \"param2\": \"value2\"}\nresp = client.post(url=\"https://httpbin.org/anything\", params=params, timeout=10)\nprint(r.text)\n\n# POST Binary Request Data\ncontent = b\"some_data\"\nresp = client.post(url=\"https://httpbin.org/anything\", content=content)\nprint(r.text)\n\n# POST Form Encoded Data\ndata = {\"key1\": \"value1\", \"key2\": \"value2\"}\nresp = client.post(url=\"https://httpbin.org/anything\", data=data)\nprint(r.text)\n\n# POST JSON Encoded Data\njson = {\"key1\": \"value1\", \"key2\": \"value2\"}\nresp = client.post(url=\"https://httpbin.org/anything\", json=json)\nprint(r.text)\n\n# POST Multipart-Encoded Files\nfiles = {'file1': '/home/root/file1.txt', 'file2': 'home/root/file2.txt'}\nr = client.post(\"https://httpbin.org/post\", files=files)\nprint(r.text)\n\n# Authentication using user/password\nauth = (\"user\", \"password\")\nresp = client.post(url=\"https://httpbin.org/anything\", auth=auth)\nprint(r.text)\n\n# Authentication using auth bearer\nauth_bearer = \"bearerXXXXXXXXXXXXXXXXXXXX\"\nresp = client.post(url=\"https://httpbin.org/anything\", auth_bearer=auth_bearer)\nprint(r.text)\n\n# Using proxy or env var PRIMP_PROXY\nresp = primp.Client(proxy=\"http://127.0.0.1:8080\").get(\"https://tls.peet.ws/api/all\")\nprint(resp.json())\nexport PRIMP_PROXY=\"socks5://127.0.0.1:1080\"\nresp = primp.Client().get(\"https://tls.peet.ws/api/all\")\nprint(resp.json())\n\n# Using custom CA certificate store: env var PRIMP_CA_BUNDLE\n#(Primp built with the Mozilla's latest trusted root certificates, so maybe it's not necessary)\nresp = primp.Client(ca_cert_file=\"/cert/cacert.pem\").get(\"https://tls.peet.ws/api/all\")\nprint(resp.json())\nresp = primp.Client(ca_cert_file=certifi.where()).get(\"https://tls.peet.ws/api/all\")\nprint(resp.json())\nexport PRIMP_CA_BUNDLE=\"/home/user/Downloads/cert.pem\"\nresp = primp.Client().get(\"https://tls.peet.ws/api/all\")\nprint(resp.json())\n\n# You can also use convenience functions that use a default Client instance under the hood:\n# primp.get() | primp.head() | primp.options() | primp.delete() | primp.post() | primp.patch() | primp.put()\n# These functions can accept the `impersonate` parameter:\nresp = primp.get(\"https://httpbin.org/anything\", impersonate=\"chrome_131\", impersonate_os=\"android\")\nprint(r.text)\n```\n\n### II. AsyncClient\n\n`primp.AsyncClient()` is an asynchronous wrapper around the `primp.Client` class, offering the same functions, behavior, and input arguments.\n\n```python3\nimport asyncio\nimport logging\n\nimport primp\n\nasync def aget_text(url):\n async with primp.AsyncClient(impersonate=\"chrome_131\") as client:\n resp = await client.get(url)\n return resp.text\n\nasync def main():\n urls = [\"https://nytimes.com/\", \"https://cnn.com/\", \"https://abcnews.go.com/\"]\n tasks = [aget_text(u) for u in urls]\n results = await asyncio.gather(*tasks)\n\nif __name__ == \"__main__\":\n logging.basicConfig(level=logging.INFO)\n asyncio.run(main())\n```\n\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "HTTP client that can impersonate web browsers, mimicking their headers and `TLS/JA3/JA4/HTTP2` fingerprints",
"version": "0.12.1",
"project_urls": null,
"split_keywords": [
"python",
" request",
" impersonate"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "d4d9169b5cf7dde1b06c61824db51ef9d1025b9ce1b4eb1cc4ded30af3b41892",
"md5": "3c2933fc5b00e51e721ec93a676a9d5f",
"sha256": "48af13b6731ab33f7045c620c7fecf4804745e2756c22ace604de24b46d07ee7"
},
"downloads": -1,
"filename": "primp-0.12.1-cp38-abi3-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "3c2933fc5b00e51e721ec93a676a9d5f",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 3161467,
"upload_time": "2025-02-11T12:42:51",
"upload_time_iso_8601": "2025-02-11T12:42:51.122049Z",
"url": "https://files.pythonhosted.org/packages/d4/d9/169b5cf7dde1b06c61824db51ef9d1025b9ce1b4eb1cc4ded30af3b41892/primp-0.12.1-cp38-abi3-macosx_10_12_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7a99e9e78e3598387b08f544dfcec73484363fcbdf58b8049a5d7ef5c689c1d8",
"md5": "bbd58fc68352ff35d682846fec5caa82",
"sha256": "83030fd7b4059125738f76f56d21322c631c6a7bb7b0f4bd58ef63c59a7ea4e3"
},
"downloads": -1,
"filename": "primp-0.12.1-cp38-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "bbd58fc68352ff35d682846fec5caa82",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 2936362,
"upload_time": "2025-02-11T12:42:48",
"upload_time_iso_8601": "2025-02-11T12:42:48.339299Z",
"url": "https://files.pythonhosted.org/packages/7a/99/e9e78e3598387b08f544dfcec73484363fcbdf58b8049a5d7ef5c689c1d8/primp-0.12.1-cp38-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "034164c7b848ef7a6ac578951b75f9950efce7a3353a9f77049d0b993118be17",
"md5": "35af8043d545aa6fac92f8a02691bfa7",
"sha256": "79380b72b3afad1aead8c4ac91797dce37605561e9a4be9dd9291d6132fdc5e7"
},
"downloads": -1,
"filename": "primp-0.12.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "35af8043d545aa6fac92f8a02691bfa7",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 3258669,
"upload_time": "2025-02-11T12:42:44",
"upload_time_iso_8601": "2025-02-11T12:42:44.345045Z",
"url": "https://files.pythonhosted.org/packages/03/41/64c7b848ef7a6ac578951b75f9950efce7a3353a9f77049d0b993118be17/primp-0.12.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d761ab27bf76f2784a1e5b559670db8475b30cc577f7652a798586e12f6f27fa",
"md5": "aa5ab0cddc1f3ee1223f8d194aea3e91",
"sha256": "286e3e620fe027a103336e5b825949350fbb5121530f57ec04cc27112cd81ea9"
},
"downloads": -1,
"filename": "primp-0.12.1-cp38-abi3-manylinux_2_34_aarch64.whl",
"has_sig": false,
"md5_digest": "aa5ab0cddc1f3ee1223f8d194aea3e91",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 3231871,
"upload_time": "2025-02-11T12:42:37",
"upload_time_iso_8601": "2025-02-11T12:42:37.321506Z",
"url": "https://files.pythonhosted.org/packages/d7/61/ab27bf76f2784a1e5b559670db8475b30cc577f7652a798586e12f6f27fa/primp-0.12.1-cp38-abi3-manylinux_2_34_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b0988c6c3703bd3b286e2ef90d0376aadccbfa61d8e7a5ec0d9af420a36097a0",
"md5": "de94bfec3987fd483abb074d315f13d1",
"sha256": "61841d3061f74d17ff124c808a00bb2efa2dcbefff18e01510363dd9c3aa0300"
},
"downloads": -1,
"filename": "primp-0.12.1-cp38-abi3-manylinux_2_34_armv7l.whl",
"has_sig": false,
"md5_digest": "de94bfec3987fd483abb074d315f13d1",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 2986939,
"upload_time": "2025-02-11T12:42:41",
"upload_time_iso_8601": "2025-02-11T12:42:41.064276Z",
"url": "https://files.pythonhosted.org/packages/b0/98/8c6c3703bd3b286e2ef90d0376aadccbfa61d8e7a5ec0d9af420a36097a0/primp-0.12.1-cp38-abi3-manylinux_2_34_armv7l.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "4f7ee1ddb1da14ed11d416cc3d683f752f18c4bacab3c5b2cd44fd1d725e0f1c",
"md5": "c8440687ec7e8c6d8297c0abe0257b59",
"sha256": "5407e49166e61287010e9bf6daf84b7b0597a15286a7fb3ad0be36ee43555b4b"
},
"downloads": -1,
"filename": "primp-0.12.1-cp38-abi3-musllinux_1_2_aarch64.whl",
"has_sig": false,
"md5_digest": "c8440687ec7e8c6d8297c0abe0257b59",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 3391011,
"upload_time": "2025-02-11T12:42:53",
"upload_time_iso_8601": "2025-02-11T12:42:53.807946Z",
"url": "https://files.pythonhosted.org/packages/4f/7e/e1ddb1da14ed11d416cc3d683f752f18c4bacab3c5b2cd44fd1d725e0f1c/primp-0.12.1-cp38-abi3-musllinux_1_2_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "9f711abab2beb64337ae050576bf24c60ee31f7c1cac878d25af3546ac696c07",
"md5": "04d21845ba2198decf3a4d5596981d78",
"sha256": "e0fad52ff964126be5996030b636ac92b110871738ff2523b3e74dcda381f226"
},
"downloads": -1,
"filename": "primp-0.12.1-cp38-abi3-musllinux_1_2_x86_64.whl",
"has_sig": false,
"md5_digest": "04d21845ba2198decf3a4d5596981d78",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 3578634,
"upload_time": "2025-02-11T12:42:56",
"upload_time_iso_8601": "2025-02-11T12:42:56.485667Z",
"url": "https://files.pythonhosted.org/packages/9f/71/1abab2beb64337ae050576bf24c60ee31f7c1cac878d25af3546ac696c07/primp-0.12.1-cp38-abi3-musllinux_1_2_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0a8df8b879fd6fa7b3ca9237d7236efb73169e228083c1b58e16ffa086c4e7ad",
"md5": "fcd70ab8b61244a2fded72a28640eee7",
"sha256": "97c8fdc145eb3e9935658a8fff5c9bdc0552fcac3dfb15a1867d3ea08529e056"
},
"downloads": -1,
"filename": "primp-0.12.1-cp38-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "fcd70ab8b61244a2fded72a28640eee7",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 3120451,
"upload_time": "2025-02-11T12:43:01",
"upload_time_iso_8601": "2025-02-11T12:43:01.259439Z",
"url": "https://files.pythonhosted.org/packages/0a/8d/f8b879fd6fa7b3ca9237d7236efb73169e228083c1b58e16ffa086c4e7ad/primp-0.12.1-cp38-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "98e116de42a8f1763e957a957c5ebfdbab7eb6a870f43608bc47c912f6196136",
"md5": "c6e3c9f6e53ea66060040118980ee594",
"sha256": "2989375b512b0fec77b4e6cc53d3fef1f2f76103b6565873f040dfea92023279"
},
"downloads": -1,
"filename": "primp-0.12.1.tar.gz",
"has_sig": false,
"md5_digest": "c6e3c9f6e53ea66060040118980ee594",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 110674,
"upload_time": "2025-02-11T12:42:58",
"upload_time_iso_8601": "2025-02-11T12:42:58.954551Z",
"url": "https://files.pythonhosted.org/packages/98/e1/16de42a8f1763e957a957c5ebfdbab7eb6a870f43608bc47c912f6196136/primp-0.12.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-11 12:42:58",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "primp"
}