mimicry-http 0.6.0rc1__py3-none-win_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.
- mimicry/__init__.py +173 -0
- mimicry/_bin/mimicry-core.exe +0 -0
- mimicry/_core.py +985 -0
- mimicry/_errors.py +270 -0
- mimicry/_pb/__init__.py +0 -0
- mimicry/_pb/mimicry/__init__.py +0 -0
- mimicry/_pb/mimicry/v1/__init__.py +0 -0
- mimicry/_pb/mimicry/v1/mimicry_pb2.py +223 -0
- mimicry/_pb/mimicry/v1/mimicry_pb2.pyi +1099 -0
- mimicry/_sync.py +527 -0
- mimicry/_types.py +779 -0
- mimicry/_version.py +1 -0
- mimicry/_wire.py +797 -0
- mimicry/aio.py +838 -0
- mimicry/profiles.py +92 -0
- mimicry/py.typed +0 -0
- mimicry_http-0.6.0rc1.dist-info/METADATA +140 -0
- mimicry_http-0.6.0rc1.dist-info/RECORD +20 -0
- mimicry_http-0.6.0rc1.dist-info/WHEEL +4 -0
- mimicry_http-0.6.0rc1.dist-info/licenses/LICENSE +21 -0
mimicry/__init__.py
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"""mimicry: HTTP requests the way Chrome, Firefox and Safari send them.
|
|
2
|
+
|
|
3
|
+
The Python SDK of github.com/roachadam/mimicry (decision 0069): each process
|
|
4
|
+
starts its own ``mimicry-core``, the Go library as a child, and speaks to it
|
|
5
|
+
over a socketpair (pipes on Windows). Go's names in Python casing:
|
|
6
|
+
|
|
7
|
+
import mimicry
|
|
8
|
+
from mimicry import Config, Kind, Request, profiles
|
|
9
|
+
|
|
10
|
+
client = mimicry.new_client(Config(profile=profiles.chrome_macos()))
|
|
11
|
+
|
|
12
|
+
# A plain request is a page load, as if typed into the address bar.
|
|
13
|
+
page = client.do(Request("GET", "https://www.shop.example/p/42"))
|
|
14
|
+
|
|
15
|
+
# A fetch() from that page: Origin, Referer, sec-fetch-* and cookies follow.
|
|
16
|
+
api = Request("GET", "https://www.shop.example/api/stock/42")
|
|
17
|
+
resp = client.do(mimicry.as_kind(api, Kind.FETCH))
|
|
18
|
+
|
|
19
|
+
This module is the sync API; :mod:`mimicry.aio` is the async one, with the
|
|
20
|
+
same names.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from __future__ import annotations
|
|
24
|
+
|
|
25
|
+
from . import profiles
|
|
26
|
+
from ._errors import (
|
|
27
|
+
BlockedError,
|
|
28
|
+
CanceledError,
|
|
29
|
+
CloseError,
|
|
30
|
+
Code,
|
|
31
|
+
CoreExited,
|
|
32
|
+
CORSError,
|
|
33
|
+
DeadlineError,
|
|
34
|
+
InternalError,
|
|
35
|
+
InvalidError,
|
|
36
|
+
MimicryError,
|
|
37
|
+
NetError,
|
|
38
|
+
NotMeasuredError,
|
|
39
|
+
PinError,
|
|
40
|
+
PlacementError,
|
|
41
|
+
ProtocolError,
|
|
42
|
+
ProxyError,
|
|
43
|
+
ValidationError,
|
|
44
|
+
VerifyError,
|
|
45
|
+
)
|
|
46
|
+
from ._sync import (
|
|
47
|
+
AltSvcCache,
|
|
48
|
+
Client,
|
|
49
|
+
ClientHintStore,
|
|
50
|
+
Core,
|
|
51
|
+
Jar,
|
|
52
|
+
Profile,
|
|
53
|
+
Response,
|
|
54
|
+
TicketCache,
|
|
55
|
+
Transport,
|
|
56
|
+
WebSocket,
|
|
57
|
+
fetch_pins,
|
|
58
|
+
list_profiles,
|
|
59
|
+
machines,
|
|
60
|
+
new_alt_svc_cache,
|
|
61
|
+
new_client,
|
|
62
|
+
new_client_hint_store,
|
|
63
|
+
new_jar,
|
|
64
|
+
new_ticket_cache,
|
|
65
|
+
new_transport,
|
|
66
|
+
parse_profile,
|
|
67
|
+
profile_spec,
|
|
68
|
+
)
|
|
69
|
+
from ._types import (
|
|
70
|
+
CertPin,
|
|
71
|
+
CertRole,
|
|
72
|
+
ClientCertificate,
|
|
73
|
+
Config,
|
|
74
|
+
ConnectionState,
|
|
75
|
+
Cookie,
|
|
76
|
+
CookieRequest,
|
|
77
|
+
Credentials,
|
|
78
|
+
CrossOrigin,
|
|
79
|
+
Headers,
|
|
80
|
+
HintDelegation,
|
|
81
|
+
Kind,
|
|
82
|
+
Lines,
|
|
83
|
+
MessageType,
|
|
84
|
+
Options,
|
|
85
|
+
Override,
|
|
86
|
+
Pin,
|
|
87
|
+
Place,
|
|
88
|
+
Plan,
|
|
89
|
+
Priority,
|
|
90
|
+
ProfileInfo,
|
|
91
|
+
Request,
|
|
92
|
+
ResponseHead,
|
|
93
|
+
SameSite,
|
|
94
|
+
SetCookieEvent,
|
|
95
|
+
WebSocketOptions,
|
|
96
|
+
as_kind,
|
|
97
|
+
exact,
|
|
98
|
+
with_options,
|
|
99
|
+
)
|
|
100
|
+
from ._version import __version__
|
|
101
|
+
|
|
102
|
+
__all__ = [
|
|
103
|
+
"AltSvcCache",
|
|
104
|
+
"BlockedError",
|
|
105
|
+
"CORSError",
|
|
106
|
+
"CanceledError",
|
|
107
|
+
"CertPin",
|
|
108
|
+
"CertRole",
|
|
109
|
+
"Client",
|
|
110
|
+
"ClientCertificate",
|
|
111
|
+
"ClientHintStore",
|
|
112
|
+
"CloseError",
|
|
113
|
+
"Code",
|
|
114
|
+
"Config",
|
|
115
|
+
"ConnectionState",
|
|
116
|
+
"Cookie",
|
|
117
|
+
"CookieRequest",
|
|
118
|
+
"Core",
|
|
119
|
+
"CoreExited",
|
|
120
|
+
"Credentials",
|
|
121
|
+
"CrossOrigin",
|
|
122
|
+
"DeadlineError",
|
|
123
|
+
"Headers",
|
|
124
|
+
"HintDelegation",
|
|
125
|
+
"InternalError",
|
|
126
|
+
"InvalidError",
|
|
127
|
+
"Jar",
|
|
128
|
+
"Kind",
|
|
129
|
+
"Lines",
|
|
130
|
+
"MessageType",
|
|
131
|
+
"MimicryError",
|
|
132
|
+
"NetError",
|
|
133
|
+
"NotMeasuredError",
|
|
134
|
+
"Options",
|
|
135
|
+
"Override",
|
|
136
|
+
"Pin",
|
|
137
|
+
"PinError",
|
|
138
|
+
"Place",
|
|
139
|
+
"PlacementError",
|
|
140
|
+
"Plan",
|
|
141
|
+
"Priority",
|
|
142
|
+
"Profile",
|
|
143
|
+
"ProfileInfo",
|
|
144
|
+
"ProtocolError",
|
|
145
|
+
"ProxyError",
|
|
146
|
+
"Request",
|
|
147
|
+
"Response",
|
|
148
|
+
"ResponseHead",
|
|
149
|
+
"SameSite",
|
|
150
|
+
"SetCookieEvent",
|
|
151
|
+
"TicketCache",
|
|
152
|
+
"Transport",
|
|
153
|
+
"ValidationError",
|
|
154
|
+
"VerifyError",
|
|
155
|
+
"WebSocket",
|
|
156
|
+
"WebSocketOptions",
|
|
157
|
+
"__version__",
|
|
158
|
+
"as_kind",
|
|
159
|
+
"exact",
|
|
160
|
+
"fetch_pins",
|
|
161
|
+
"list_profiles",
|
|
162
|
+
"machines",
|
|
163
|
+
"new_alt_svc_cache",
|
|
164
|
+
"new_client",
|
|
165
|
+
"new_client_hint_store",
|
|
166
|
+
"new_jar",
|
|
167
|
+
"new_ticket_cache",
|
|
168
|
+
"new_transport",
|
|
169
|
+
"parse_profile",
|
|
170
|
+
"profile_spec",
|
|
171
|
+
"profiles",
|
|
172
|
+
"with_options",
|
|
173
|
+
]
|
|
Binary file
|