specters 2.0.0__cp310-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.
- specter/__init__.py +75 -0
- specter/specter.abi3.so +0 -0
- specters-2.0.0.dist-info/METADATA +97 -0
- specters-2.0.0.dist-info/RECORD +5 -0
- specters-2.0.0.dist-info/WHEEL +4 -0
specter/__init__.py
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Specter - Python bindings for the Specter HTTP client.
|
|
3
|
+
|
|
4
|
+
A high-performance async HTTP client with full TLS, HTTP/2, and HTTP/3
|
|
5
|
+
fingerprint control for browser impersonation.
|
|
6
|
+
|
|
7
|
+
Basic usage:
|
|
8
|
+
>>> import asyncio
|
|
9
|
+
>>> import specter
|
|
10
|
+
>>>
|
|
11
|
+
>>> async def main():
|
|
12
|
+
... # Create a client with default settings
|
|
13
|
+
... client = specter.Client.builder().build()
|
|
14
|
+
...
|
|
15
|
+
... # Simple GET request
|
|
16
|
+
... response = await client.get("https://httpbin.org/get").send()
|
|
17
|
+
... print(f"Status: {response.status}")
|
|
18
|
+
... print(await response.text())
|
|
19
|
+
...
|
|
20
|
+
>>> asyncio.run(main())
|
|
21
|
+
|
|
22
|
+
With headers and body:
|
|
23
|
+
>>> async def main():
|
|
24
|
+
... client = specter.Client.builder().build()
|
|
25
|
+
...
|
|
26
|
+
... # POST with JSON body
|
|
27
|
+
... request = client.post("https://api.example.com/data")
|
|
28
|
+
... request.header("Authorization", "Bearer token")
|
|
29
|
+
... request.json('{"name": "test"}')
|
|
30
|
+
... response = await request.send()
|
|
31
|
+
...
|
|
32
|
+
... # Or chain the calls
|
|
33
|
+
... response = await (client.post("https://api.example.com/data")
|
|
34
|
+
... .header("Authorization", "Bearer token")
|
|
35
|
+
... .json('{"name": "test"}')
|
|
36
|
+
... .send())
|
|
37
|
+
...
|
|
38
|
+
>>> asyncio.run(main())
|
|
39
|
+
|
|
40
|
+
With fingerprinting:
|
|
41
|
+
>>> builder = specter.Client.builder()
|
|
42
|
+
>>> builder.fingerprint(specter.FingerprintProfile.Chrome142)
|
|
43
|
+
>>> client = builder.build()
|
|
44
|
+
|
|
45
|
+
With custom timeouts:
|
|
46
|
+
>>> timeouts = (specter.Timeouts()
|
|
47
|
+
... .connect(5.0)
|
|
48
|
+
... .total(30.0))
|
|
49
|
+
>>> builder = specter.Client.builder()
|
|
50
|
+
>>> builder.timeouts(timeouts)
|
|
51
|
+
>>> client = builder.build()
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
from .specter import (
|
|
55
|
+
Client,
|
|
56
|
+
ClientBuilder,
|
|
57
|
+
RequestBuilder,
|
|
58
|
+
Response,
|
|
59
|
+
CookieJar,
|
|
60
|
+
FingerprintProfile,
|
|
61
|
+
HttpVersion,
|
|
62
|
+
Timeouts,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
__version__ = "1.2.0"
|
|
66
|
+
__all__ = [
|
|
67
|
+
"Client",
|
|
68
|
+
"ClientBuilder",
|
|
69
|
+
"RequestBuilder",
|
|
70
|
+
"Response",
|
|
71
|
+
"CookieJar",
|
|
72
|
+
"FingerprintProfile",
|
|
73
|
+
"HttpVersion",
|
|
74
|
+
"Timeouts",
|
|
75
|
+
]
|
specter/specter.abi3.so
ADDED
|
Binary file
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: specters
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Programming Language :: Rust
|
|
14
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
Requires-Dist: pytest ; extra == 'dev'
|
|
17
|
+
Requires-Dist: pytest-asyncio ; extra == 'dev'
|
|
18
|
+
Requires-Dist: maturin ; extra == 'dev'
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Summary: Python bindings for Specter HTTP client with TLS/HTTP2/HTTP3 fingerprint control
|
|
21
|
+
Keywords: http,http3,fingerprint,tls,client,async
|
|
22
|
+
License: MIT
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
25
|
+
|
|
26
|
+
# Specter
|
|
27
|
+
|
|
28
|
+
Python bindings for the Specter HTTP client - an HTTP client that accurately replicates Chrome's TLS and HTTP/2 behavior.
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install specters
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
- HTTP/1.1, HTTP/2, and HTTP/3 support
|
|
39
|
+
- Chrome 142 TLS fingerprint (BoringSSL)
|
|
40
|
+
- Chrome HTTP/2 fingerprint (SETTINGS, pseudo-header order, GREASE)
|
|
41
|
+
- Async/await interface
|
|
42
|
+
- Cookie jar with Netscape format support
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
import asyncio
|
|
48
|
+
from specter import Client, FingerprintProfile
|
|
49
|
+
|
|
50
|
+
async def main():
|
|
51
|
+
client = Client(fingerprint=FingerprintProfile.Chrome142)
|
|
52
|
+
|
|
53
|
+
response = await client.get("https://example.com")
|
|
54
|
+
print(f"Status: {response.status}")
|
|
55
|
+
print(f"Body: {response.text()}")
|
|
56
|
+
|
|
57
|
+
asyncio.run(main())
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Force HTTP version
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from specter import HttpVersion
|
|
64
|
+
|
|
65
|
+
# HTTP/2 only
|
|
66
|
+
response = await client.get(url, version=HttpVersion.Http2)
|
|
67
|
+
|
|
68
|
+
# HTTP/3 with fallback
|
|
69
|
+
response = await client.get(url, version=HttpVersion.Http3)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Custom headers and cookies
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
from specter import CookieJar
|
|
76
|
+
|
|
77
|
+
jar = CookieJar()
|
|
78
|
+
await jar.load_from_file("cookies.txt")
|
|
79
|
+
|
|
80
|
+
response = await client.get(url, cookies=jar)
|
|
81
|
+
jar.store_from_headers(response.headers, url)
|
|
82
|
+
|
|
83
|
+
await jar.save_to_file("cookies.txt")
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Validation
|
|
87
|
+
|
|
88
|
+
Specter fingerprints are validated against:
|
|
89
|
+
- ScrapFly (tools.scrapfly.io)
|
|
90
|
+
- Browserleaks (tls.browserleaks.com)
|
|
91
|
+
- tls.peet.ws
|
|
92
|
+
- Cloudflare
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT
|
|
97
|
+
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
specter/__init__.py,sha256=qgNigyD_7RUq2xMHVhwIYmAVAn4yFx_q3w5So2UY5LM,2011
|
|
2
|
+
specter/specter.abi3.so,sha256=JV3aDUBlmJCaXqcuMQUAXx_4RtU2gFG7W4fyJJrbdlA,4834272
|
|
3
|
+
specters-2.0.0.dist-info/METADATA,sha256=dsa6AJHJJM1bns9m_Ryl1Cg3hiIVanYKVZgMsbhgHrw,2444
|
|
4
|
+
specters-2.0.0.dist-info/WHEEL,sha256=vZ12AMAE5CVtd8oYbYGrz3omfHuIZCNO_3P50V00s00,104
|
|
5
|
+
specters-2.0.0.dist-info/RECORD,,
|