never-primp 1.0.0__cp38-abi3-macosx_11_0_arm64.whl → 1.0.2__cp38-abi3-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of never-primp might be problematic. Click here for more details.

@@ -0,0 +1,8 @@
1
+ never_primp-1.0.2.dist-info/METADATA,sha256=yS-XIFcymNLuyuituxwsaAbUxbYGXDmpJORxvuL-YoI,21538
2
+ never_primp-1.0.2.dist-info/WHEEL,sha256=gnJiauUA-C9eduukCSYPRAnEnckuUqP6yenZ8c1xV7c,102
3
+ never_primp-1.0.2.dist-info/licenses/LICENSE,sha256=ZPD9tCar0h91tI4v-TuZdrjDdLqzU4rzPTxtP3x--uc,1063
4
+ never_primp/__init__.py,sha256=VJpMdLIxFdJjh5sYhma2GcPvUxrpf0b55rPkZ4vMCAg,17791
5
+ never_primp/never_primp.abi3.so,sha256=vSXyXn7b9SKEvrggSsMJE1pEIhrjDWowdyDlMqaJYZw,6358640
6
+ never_primp/never_primp.pyi,sha256=SRRGmMTe-RUesKoBnYkFbNT-HD0BxZhPubfAbLt9SRk,7820
7
+ never_primp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ never_primp-1.0.2.dist-info/RECORD,,
@@ -1,358 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: never_primp
3
- Version: 1.0.0
4
- Classifier: Development Status :: 5 - Production/Stable
5
- Classifier: Intended Audience :: Developers
6
- Classifier: License :: OSI Approved :: MIT License
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: Programming Language :: Python :: 3.8
9
- Classifier: Programming Language :: Python :: 3.9
10
- Classifier: Programming Language :: Python :: 3.10
11
- Classifier: Programming Language :: Python :: 3.11
12
- Classifier: Programming Language :: Python :: 3.12
13
- Classifier: Programming Language :: Python :: 3.13
14
- Classifier: Programming Language :: Python :: Implementation :: CPython
15
- Classifier: Programming Language :: Rust
16
- Classifier: Topic :: Internet :: WWW/HTTP
17
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
- License-File: LICENSE
19
- Summary: 基于原primp 重新优化调整的请求库 - The fastest python HTTP client that can impersonate web browsers
20
- Keywords: requests,httpx,http,http-client,tls-fingerprint,ja3,ja4,impersonate,browser-impersonation,web-scraping,crawler,reverse-engineering
21
- Author: Neverland
22
- Requires-Python: >=3.8
23
- Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
24
- Project-URL: Homepage, https://github.com/Neverland/never_primp
25
- Project-URL: Repository, https://github.com/Neverland/never_primp
26
- Project-URL: Bug Tracker, https://github.com/Neverland/never_primp/issues
27
-
28
- ![Python >= 3.8](https://img.shields.io/badge/python->=3.8-red.svg) [![](https://badgen.net/github/release/deedy5/pyreqwest-impersonate)](https://github.com/deedy5/pyreqwest-impersonate/releases) [![](https://badge.fury.io/py/primp.svg)](https://pypi.org/project/primp) [![Downloads](https://static.pepy.tech/badge/primp/week)](https://pepy.tech/project/primp) [![CI](https://github.com/deedy5/pyreqwest-impersonate/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/deedy5/pyreqwest-impersonate/actions/workflows/CI.yml)
29
- # 🪞NEVER_PRIMP
30
- **🪞NEVER_PRIMP** = **P**ython **R**equests **IMP**ersonate
31
-
32
- The fastest python HTTP client that can impersonate web browsers.</br>
33
- Provides precompiled wheels:</br>
34
- * 🐧 linux: `amd64`, `aarch64`, `armv7` (⚠️aarch64 and armv7 builds are `manylinux_2_34` compatible - `ubuntu>=22.04`, `debian>=12`);</br>
35
- * 🐧 musllinux: `amd64`, `aarch64`;</br>
36
- * 🪟 windows: `amd64`;</br>
37
- * 🍏 macos: `amd64`, `aarch64`.</br>
38
-
39
- ## Table of Contents
40
-
41
- - [Installation](#installation)
42
- - [Key Features](#key-features)
43
- - [Benchmark](#benchmark)
44
- - [Usage](#usage)
45
- - [I. Client](#i-client)
46
- - [Client methods](#client-methods)
47
- - [Response object](#response-object)
48
- - [Devices](#devices)
49
- - [Examples](#examples)
50
- - [II. AsyncClient](#ii-asyncclient)
51
- - [Disclaimer](#disclaimer)
52
-
53
- ## Installation
54
-
55
- ```python
56
- pip install -U never_primp
57
- ```
58
-
59
- ## Key Features
60
-
61
- 🚀 **Performance Optimized**
62
- - Connection pooling with configurable idle timeout and max connections per host
63
- - TCP optimization (TCP_NODELAY, TCP keepalive)
64
- - ~59% faster for sequential requests with connection reuse
65
-
66
- 🔒 **Advanced Certificate Management**
67
- - Uses system's native certificate store (auto-updated with OS)
68
- - No more certificate expiration issues
69
- - Custom CA bundle support
70
-
71
- 🍪 **Smart Cookie Management**
72
- - Automatic cookie persistence using wreq's native Jar API
73
- - Manual cookie control with `get_cookies()` / `set_cookies()`
74
- - Cookies survive client configuration changes
75
-
76
- ⚙️ **Dynamic Configuration**
77
- - Modify headers, proxy, and impersonation at runtime
78
- - No need to recreate the client
79
- - Thread-safe configuration updates
80
-
81
- 🔄 **Retry Mechanism**
82
- - Configurable retry count and backoff timing
83
- - Handle transient failures gracefully
84
-
85
- 🎭 **Browser Impersonation**
86
- - Impersonate Chrome, Safari, Edge, Firefox, OkHttp
87
- - Mimic TLS/JA3/JA4/HTTP2 fingerprints
88
- - Custom OS impersonation (Windows, macOS, Linux, Android, iOS)
89
-
90
- ## Usage
91
- ### I. Client
92
-
93
- HTTP client that can impersonate web browsers.
94
- ```python
95
- class Client:
96
- """Initializes an HTTP client that can impersonate web browsers.
97
-
98
- Args:
99
- auth (tuple[str, str| None] | None): Username and password for basic authentication. Default is None.
100
- auth_bearer (str | None): Bearer token for authentication. Default is None.
101
- params (dict[str, str] | None): Default query parameters to include in all requests. Default is None.
102
- headers (dict[str, str] | None): Default headers to send with requests. If `impersonate` is set, this will be ignored.
103
- timeout (float | None): HTTP request timeout in seconds. Default is 30.
104
- cookie_store (bool | None): Enable a persistent cookie store. Received cookies will be preserved and included
105
- in additional requests. Default is True.
106
- referer (bool | None): Enable or disable automatic setting of the `Referer` header. Default is True.
107
- proxy (str | None): Proxy URL for HTTP requests. Example: "socks5://127.0.0.1:9150". Default is None.
108
- impersonate (str | None): Entity to impersonate. Example: "chrome_124". Default is None.
109
- Chrome: "chrome_100","chrome_101","chrome_104","chrome_105","chrome_106","chrome_107","chrome_108",
110
- "chrome_109","chrome_114","chrome_116","chrome_117","chrome_118","chrome_119","chrome_120",
111
- "chrome_123","chrome_124","chrome_126","chrome_127","chrome_128","chrome_129","chrome_130",
112
- "chrome_131","chrome_133"
113
- Safari: "safari_ios_16.5","safari_ios_17.2","safari_ios_17.4.1","safari_ios_18.1.1",
114
- "safari_15.3","safari_15.5","safari_15.6.1","safari_16","safari_16.5","safari_17.0",
115
- "safari_17.2.1","safari_17.4.1","safari_17.5","safari_18","safari_18.2","safari_ipad_18"
116
- OkHttp: "okhttp_3.9","okhttp_3.11","okhttp_3.13","okhttp_3.14","okhttp_4.9","okhttp_4.10","okhttp_5"
117
- Edge: "edge_101","edge_122","edge_127","edge_131"
118
- Firefox: "firefox_109","firefox_117","firefox_128","firefox_133","firefox_135"
119
- Select random: "random"
120
- impersonate_os (str | None): impersonate OS. Example: "windows". Default is "linux".
121
- Android: "android", iOS: "ios", Linux: "linux", Mac OS: "macos", Windows: "windows"
122
- Select random: "random"
123
- follow_redirects (bool | None): Whether to follow redirects. Default is True.
124
- max_redirects (int | None): Maximum redirects to follow. Default 20. Applies if `follow_redirects` is True.
125
- verify (bool | None): Verify SSL certificates. Default is True.
126
- ca_cert_file (str | None): Path to CA certificate store. Default is None.
127
- https_only (bool | None): Restrict the Client to be used with HTTPS only requests. Default is False.
128
- http2_only (bool | None): If true - use only HTTP/2; if false - use only HTTP/1. Default is False.
129
- pool_idle_timeout (float | None): Connection pool idle timeout in seconds. Default is None.
130
- pool_max_idle_per_host (int | None): Maximum number of idle connections per host. Default is None.
131
- tcp_nodelay (bool | None): Enable TCP_NODELAY (disable Nagle's algorithm). Default is None.
132
- tcp_keepalive (float | None): TCP keepalive interval in seconds. Default is None.
133
- retry_count (int | None): Maximum number of retry attempts. Default is None.
134
- retry_backoff (float | None): Backoff time between retries in seconds. Default is None.
135
-
136
- """
137
- ```
138
-
139
- #### Client methods
140
-
141
- 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`.
142
- ```python
143
- def get(
144
- url: str,
145
- params: dict[str, str] | None = None,
146
- headers: dict[str, str] | None = None,
147
- cookies: dict[str, str] | None = None,
148
- auth: tuple[str, str| None] | None = None,
149
- auth_bearer: str | None = None,
150
- timeout: float | None = 30,
151
- ):
152
- """Performs a GET request to the specified URL.
153
-
154
- Args:
155
- url (str): The URL to which the request will be made.
156
- params (dict[str, str] | None): A map of query parameters to append to the URL. Default is None.
157
- headers (dict[str, str] | None): A map of HTTP headers to send with the request. Default is None.
158
- cookies (dict[str, str] | None): - An optional map of cookies to send with requests as the `Cookie` header.
159
- auth (tuple[str, str| None] | None): A tuple containing the username and an optional password
160
- for basic authentication. Default is None.
161
- auth_bearer (str | None): A string representing the bearer token for bearer token authentication. Default is None.
162
- timeout (float | None): The timeout for the request in seconds. Default is 30.
163
-
164
- """
165
- ```
166
- ```python
167
- def post(
168
- url: str,
169
- params: dict[str, str] | None = None,
170
- headers: dict[str, str] | None = None,
171
- cookies: dict[str, str] | None = None,
172
- content: bytes | None = None,
173
- data: dict[str, Any] | None = None,
174
- json: Any | None = None,
175
- files: dict[str, str] | None = None,
176
- auth: tuple[str, str| None] | None = None,
177
- auth_bearer: str | None = None,
178
- timeout: float | None = 30,
179
- ):
180
- """Performs a POST request to the specified URL.
181
-
182
- Args:
183
- url (str): The URL to which the request will be made.
184
- params (dict[str, str] | None): A map of query parameters to append to the URL. Default is None.
185
- headers (dict[str, str] | None): A map of HTTP headers to send with the request. Default is None.
186
- cookies (dict[str, str] | None): - An optional map of cookies to send with requests as the `Cookie` header.
187
- content (bytes | None): The content to send in the request body as bytes. Default is None.
188
- data (dict[str, Any] | None): The form data to send in the request body. Default is None.
189
- json (Any | None): A JSON serializable object to send in the request body. Default is None.
190
- files (dict[str, str] | None): A map of file fields to file paths to be sent as multipart/form-data. Default is None.
191
- auth (tuple[str, str| None] | None): A tuple containing the username and an optional password
192
- for basic authentication. Default is None.
193
- auth_bearer (str | None): A string representing the bearer token for bearer token authentication. Default is None.
194
- timeout (float | None): The timeout for the request in seconds. Default is 30.
195
-
196
- """
197
- ```
198
- #### Response object
199
- ```python
200
- resp.content
201
- resp.stream() # stream the response body in chunks of bytes
202
- resp.cookies
203
- resp.encoding
204
- resp.headers
205
- resp.json()
206
- resp.status_code
207
- resp.text
208
- resp.text_markdown # html is converted to markdown text
209
- resp.text_plain # html is converted to plain text
210
- resp.text_rich # html is converted to rich text
211
- resp.url
212
- ```
213
-
214
- #### Devices
215
-
216
- ##### Impersonate
217
-
218
- - 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`, `chrome_133`, `chrome_134`, `chrome_135`, `chrome_136`, `chrome_137`, `chrome_138`, `chrome_139`, `chrome_140`, `chrome_141`
219
-
220
- - Edge: `edge_101`,`edge_122`,`edge_127`, `edge_131`, `edge_134`
221
-
222
- - 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`, `safari_ipad_26`, `safari_ios_26`, `safari_26`
223
-
224
- - OkHttp: `okhttp_3.9`,`okhttp_3.11`,`okhttp_3.13`,`okhttp_3.14`,`okhttp_4.9`,`okhttp_4.10`,`okhttp_5`
225
-
226
- - Firefox: `firefox_109`, `firefox_117`, `firefox_128`, `firefox_133`, `firefox_135`, `firefox_136`, `firefox_139`, `firefox_142`, `firefox_143`
227
-
228
- ##### Impersonate OS
229
-
230
- - `android`, `ios`, `linux`, `macos`, `windows`
231
-
232
- #### Examples
233
-
234
- ```python
235
- import never_primp as primp
236
-
237
- # Impersonate
238
- client = primp.Client(impersonate="chrome_131", impersonate_os="windows")
239
-
240
- # Performance optimization with connection pooling
241
- client = primp.Client(
242
- impersonate="chrome_131",
243
- pool_idle_timeout=90.0, # Keep connections alive for 90 seconds
244
- pool_max_idle_per_host=10, # Max 10 idle connections per host
245
- tcp_nodelay=True, # Disable Nagle's algorithm for lower latency
246
- tcp_keepalive=60.0, # TCP keepalive every 60 seconds
247
- )
248
-
249
- # Retry mechanism
250
- client = primp.Client(
251
- retry_count=3, # Retry up to 3 times
252
- retry_backoff=1.0, # 1 second backoff between retries
253
- )
254
-
255
- # Dynamic configuration updates
256
- client.headers = {"User-Agent": "Custom User Agent"} # Update all headers
257
- client.headers_update({"Referer": "https://example.com"}) # Merge new headers
258
- client.proxy = "http://127.0.0.1:8080" # Change proxy
259
- client.impersonate = "chrome_133" # Change browser impersonation
260
- client.impersonate_os = "macos" # Change OS impersonation
261
-
262
- # GET request
263
- resp = client.get("https://tls.peet.ws/api/all")
264
-
265
- # GET request with passing params and setting timeout
266
- params = {"param1": "value1", "param2": "value2"}
267
- resp = client.post(url="https://httpbin.org/anything", params=params, timeout=10)
268
-
269
- # Stream response
270
- resp = client.get("https://nytimes")
271
- for chunk in resp.stream():
272
- print(chunk)
273
-
274
- # Cookie management - Automatic (recommended)
275
- client = primp.Client(cookie_store=True) # Default: enabled
276
- resp = client.get("https://httpbin.org/cookies/set?session=abc123")
277
- # Cookies are automatically stored and sent in subsequent requests
278
- resp2 = client.get("https://httpbin.org/cookies") # Session cookie automatically included
279
-
280
- # Cookie management - Manual
281
- cookies = {"c1_n": "c1_value", "c2_n": "c2_value"}
282
- client.set_cookies(url="https://nytimes.com", cookies=cookies) # Set cookies for a specific domain
283
- resp = client.get("https://nytimes.com/", cookies=cookies) # Or pass cookies in request
284
-
285
- # Get cookies
286
- all_cookies = client.get_cookies(url="https://nytimes.com") # Get all cookies from jar
287
- response_cookies = resp.cookies # Get cookies from response
288
-
289
- # POST Binary Request Data
290
- content = b"some_data"
291
- resp = client.post(url="https://httpbin.org/anything", content=content)
292
-
293
- # POST Form Encoded Data
294
- data = {"key1": "value1", "key2": "value2"}
295
- resp = client.post(url="https://httpbin.org/anything", data=data)
296
-
297
- # POST JSON Encoded Data
298
- json = {"key1": "value1", "key2": "value2"}
299
- resp = client.post(url="https://httpbin.org/anything", json=json)
300
-
301
- # POST Multipart-Encoded Files
302
- files = {'file1': '/home/root/file1.txt', 'file2': 'home/root/file2.txt'}
303
- resp = client.post("https://httpbin.org/post", files=files)
304
-
305
- # Authentication using user/password
306
- resp = client.post(url="https://httpbin.org/anything", auth=("user", "password"))
307
-
308
- # Authentication using auth bearer
309
- resp = client.post(url="https://httpbin.org/anything", auth_bearer="bearerXXXXXXXXXXXXXXXXXXXX")
310
-
311
- # Using proxy or env var PRIMP_PROXY
312
- resp = primp.Client(proxy="http://127.0.0.1:8080") # set proxy in Client
313
- export PRIMP_PROXY="socks5://127.0.0.1:1080" # set proxy as environment variable
314
-
315
- # SSL/TLS certificate verification
316
- # Note: Primp uses your system's native certificate store by default (auto-updated with OS)
317
- resp = primp.Client(verify=True) # Default: uses system certificates
318
-
319
- # Using custom CA certificate store:
320
- resp = primp.Client(ca_cert_file="/cert/cacert.pem")
321
- resp = primp.Client(ca_cert_file=certifi.where())
322
- export PRIMP_CA_BUNDLE="/home/user/Downloads/cert.pem" # set as environment variable
323
-
324
- # You can also use convenience functions that use a default Client instance under the hood:
325
- # primp.get() | primp.head() | primp.options() | primp.delete() | primp.post() | primp.patch() | primp.put()
326
- # These functions can accept the `impersonate` parameter:
327
- resp = primp.get("https://httpbin.org/anything", impersonate="chrome_131", impersonate_os="android")
328
- ```
329
-
330
- ### II. AsyncClient
331
-
332
- `primp.AsyncClient()` is an asynchronous wrapper around the `primp.Client` class, offering the same functions, behavior, and input arguments.
333
-
334
- ```python3
335
- import asyncio
336
- import logging
337
-
338
- import never_primp as primp
339
-
340
- async def aget_text(url):
341
- async with primp.AsyncClient(impersonate="chrome_131") as client:
342
- resp = await client.get(url)
343
- return resp.text
344
-
345
- async def main():
346
- urls = ["https://nytimes.com/", "https://cnn.com/", "https://abcnews.go.com/"]
347
- tasks = [aget_text(u) for u in urls]
348
- results = await asyncio.gather(*tasks)
349
-
350
- if __name__ == "__main__":
351
- logging.basicConfig(level=logging.INFO)
352
- asyncio.run(main())
353
- ```
354
-
355
- ## Disclaimer
356
-
357
- This tool is for educational purposes only. Use it at your own risk.
358
-
@@ -1,8 +0,0 @@
1
- never_primp-1.0.0.dist-info/METADATA,sha256=zdZwLTtqakrAR7ukQb2kTC1_n-ag04PI3AWGzaEWtkw,16845
2
- never_primp-1.0.0.dist-info/WHEEL,sha256=gnJiauUA-C9eduukCSYPRAnEnckuUqP6yenZ8c1xV7c,102
3
- never_primp-1.0.0.dist-info/licenses/LICENSE,sha256=ZPD9tCar0h91tI4v-TuZdrjDdLqzU4rzPTxtP3x--uc,1063
4
- never_primp/__init__.py,sha256=St0t0qYotaV3BC4-854NRKEJ0LnUMykXJlY73Em9Sxg,12541
5
- never_primp/never_primp.abi3.so,sha256=o_pdwGAvljm30ryaXlB0cXD2kvz_DjMzXnGSY8_gvt4,6325504
6
- never_primp/never_primp.pyi,sha256=8QRuXaqNfk29qkFZrbtwKKK92Y_wL-O702nys8DCcM0,5731
7
- never_primp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- never_primp-1.0.0.dist-info/RECORD,,