curlpro 0.2.0__tar.gz

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.
Files changed (185) hide show
  1. curlpro-0.2.0/LICENSE +202 -0
  2. curlpro-0.2.0/MANIFEST.in +9 -0
  3. curlpro-0.2.0/NOTICE +29 -0
  4. curlpro-0.2.0/PKG-INFO +114 -0
  5. curlpro-0.2.0/README.md +89 -0
  6. curlpro-0.2.0/curlpro/__init__.py +61 -0
  7. curlpro-0.2.0/curlpro/_completions.py +142 -0
  8. curlpro-0.2.0/curlpro/_ffi.py +302 -0
  9. curlpro-0.2.0/curlpro/aio.py +404 -0
  10. curlpro-0.2.0/curlpro/cookies.py +308 -0
  11. curlpro-0.2.0/curlpro/encoding.py +95 -0
  12. curlpro-0.2.0/curlpro/expect.py +176 -0
  13. curlpro-0.2.0/curlpro/headers.py +89 -0
  14. curlpro-0.2.0/curlpro/profiles/chrome-100-windows.json +74 -0
  15. curlpro-0.2.0/curlpro/profiles/chrome-101-windows.json +74 -0
  16. curlpro-0.2.0/curlpro/profiles/chrome-104-windows.json +74 -0
  17. curlpro-0.2.0/curlpro/profiles/chrome-107-windows.json +74 -0
  18. curlpro-0.2.0/curlpro/profiles/chrome-110-windows.json +77 -0
  19. curlpro-0.2.0/curlpro/profiles/chrome-116-windows.json +77 -0
  20. curlpro-0.2.0/curlpro/profiles/chrome-118-linux.json +388 -0
  21. curlpro-0.2.0/curlpro/profiles/chrome-119-linux.json +391 -0
  22. curlpro-0.2.0/curlpro/profiles/chrome-119-macos.json +391 -0
  23. curlpro-0.2.0/curlpro/profiles/chrome-120-linux.json +388 -0
  24. curlpro-0.2.0/curlpro/profiles/chrome-120-macos.json +391 -0
  25. curlpro-0.2.0/curlpro/profiles/chrome-123-macos.json +388 -0
  26. curlpro-0.2.0/curlpro/profiles/chrome-124-macos.json +394 -0
  27. curlpro-0.2.0/curlpro/profiles/chrome-131-android.json +78 -0
  28. curlpro-0.2.0/curlpro/profiles/chrome-131-macos.json +394 -0
  29. curlpro-0.2.0/curlpro/profiles/chrome-133-macos.json +394 -0
  30. curlpro-0.2.0/curlpro/profiles/chrome-136-macos.json +78 -0
  31. curlpro-0.2.0/curlpro/profiles/chrome-142-macos.json +78 -0
  32. curlpro-0.2.0/curlpro/profiles/chrome-150-macos.json +397 -0
  33. curlpro-0.2.0/curlpro/profiles/chrome-151-windows.json +332 -0
  34. curlpro-0.2.0/curlpro/profiles/chrome-152-android.json +375 -0
  35. curlpro-0.2.0/curlpro/profiles/chrome-152-windows.json +130 -0
  36. curlpro-0.2.0/curlpro/profiles/chrome-98-windows.json +369 -0
  37. curlpro-0.2.0/curlpro/profiles/chrome-99-android.json +74 -0
  38. curlpro-0.2.0/curlpro/profiles/chrome-99-windows.json +74 -0
  39. curlpro-0.2.0/curlpro/profiles/edge-101-windows.json +74 -0
  40. curlpro-0.2.0/curlpro/profiles/edge-118-linux.json +388 -0
  41. curlpro-0.2.0/curlpro/profiles/edge-119-linux.json +388 -0
  42. curlpro-0.2.0/curlpro/profiles/edge-120-linux.json +391 -0
  43. curlpro-0.2.0/curlpro/profiles/edge-98-windows.json +74 -0
  44. curlpro-0.2.0/curlpro/profiles/edge-99-windows.json +74 -0
  45. curlpro-0.2.0/curlpro/profiles/firefox-133-macos.json +395 -0
  46. curlpro-0.2.0/curlpro/profiles/firefox-135-macos.json +398 -0
  47. curlpro-0.2.0/curlpro/profiles/firefox-144-macos.json +70 -0
  48. curlpro-0.2.0/curlpro/profiles/safari-15.3-macos.json +176 -0
  49. curlpro-0.2.0/curlpro/profiles/safari-15.5-macos.json +176 -0
  50. curlpro-0.2.0/curlpro/profiles/safari-17-ios.json +66 -0
  51. curlpro-0.2.0/curlpro/profiles/safari-17-macos.json +66 -0
  52. curlpro-0.2.0/curlpro/profiles/safari-18.0-ios.json +214 -0
  53. curlpro-0.2.0/curlpro/profiles/safari-18.0-macos.json +46 -0
  54. curlpro-0.2.0/curlpro/profiles/safari-18.4-ios.json +74 -0
  55. curlpro-0.2.0/curlpro/profiles/safari-18.4-macos.json +74 -0
  56. curlpro-0.2.0/curlpro/profiles/safari-26-ios.json +211 -0
  57. curlpro-0.2.0/curlpro/profiles/safari-26.0-macos.json +210 -0
  58. curlpro-0.2.0/curlpro/profiles/safari-26.0.1-macos.json +207 -0
  59. curlpro-0.2.0/curlpro/profiles/tor-14-macos.json +380 -0
  60. curlpro-0.2.0/curlpro/profiles/yandex-26.8-android.json +329 -0
  61. curlpro-0.2.0/curlpro/profiles.py +121 -0
  62. curlpro-0.2.0/curlpro/proxies.py +50 -0
  63. curlpro-0.2.0/curlpro/py.typed +0 -0
  64. curlpro-0.2.0/curlpro/session.py +904 -0
  65. curlpro-0.2.0/curlpro/stream.py +146 -0
  66. curlpro-0.2.0/curlpro/timeouts.py +31 -0
  67. curlpro-0.2.0/curlpro/websocket.py +132 -0
  68. curlpro-0.2.0/curlpro.egg-info/PKG-INFO +114 -0
  69. curlpro-0.2.0/curlpro.egg-info/SOURCES.txt +183 -0
  70. curlpro-0.2.0/curlpro.egg-info/dependency_links.txt +1 -0
  71. curlpro-0.2.0/curlpro.egg-info/top_level.txt +1 -0
  72. curlpro-0.2.0/go/go.mod +23 -0
  73. curlpro-0.2.0/go/go.sum +54 -0
  74. curlpro-0.2.0/go/internal/client/altsvc.go +161 -0
  75. curlpro-0.2.0/go/internal/client/altsvc_test.go +140 -0
  76. curlpro-0.2.0/go/internal/client/audit_test.go +628 -0
  77. curlpro-0.2.0/go/internal/client/body.go +43 -0
  78. curlpro-0.2.0/go/internal/client/bridge.go +52 -0
  79. curlpro-0.2.0/go/internal/client/client.go +922 -0
  80. curlpro-0.2.0/go/internal/client/concurrency_test.go +460 -0
  81. curlpro-0.2.0/go/internal/client/conn.go +250 -0
  82. curlpro-0.2.0/go/internal/client/cookies.go +233 -0
  83. curlpro-0.2.0/go/internal/client/decompress.go +139 -0
  84. curlpro-0.2.0/go/internal/client/errors.go +73 -0
  85. curlpro-0.2.0/go/internal/client/fix_test.go +763 -0
  86. curlpro-0.2.0/go/internal/client/h3order_test.go +180 -0
  87. curlpro-0.2.0/go/internal/client/h3stand_test.go +281 -0
  88. curlpro-0.2.0/go/internal/client/headers.go +477 -0
  89. curlpro-0.2.0/go/internal/client/headers_test.go +285 -0
  90. curlpro-0.2.0/go/internal/client/hints.go +142 -0
  91. curlpro-0.2.0/go/internal/client/hints_test.go +143 -0
  92. curlpro-0.2.0/go/internal/client/http3.go +338 -0
  93. curlpro-0.2.0/go/internal/client/keepalive_test.go +95 -0
  94. curlpro-0.2.0/go/internal/client/memory_test.go +157 -0
  95. curlpro-0.2.0/go/internal/client/mode.go +179 -0
  96. curlpro-0.2.0/go/internal/client/multipart.go +120 -0
  97. curlpro-0.2.0/go/internal/client/pool.go +299 -0
  98. curlpro-0.2.0/go/internal/client/protocol_test.go +191 -0
  99. curlpro-0.2.0/go/internal/client/proxy.go +252 -0
  100. curlpro-0.2.0/go/internal/client/proxyauth_test.go +174 -0
  101. curlpro-0.2.0/go/internal/client/quicspec_test.go +102 -0
  102. curlpro-0.2.0/go/internal/client/race_off_test.go +6 -0
  103. curlpro-0.2.0/go/internal/client/race_on_test.go +10 -0
  104. curlpro-0.2.0/go/internal/client/redirect.go +235 -0
  105. curlpro-0.2.0/go/internal/client/retry.go +238 -0
  106. curlpro-0.2.0/go/internal/client/retry_test.go +113 -0
  107. curlpro-0.2.0/go/internal/client/sessionheaders.go +122 -0
  108. curlpro-0.2.0/go/internal/client/stream.go +328 -0
  109. curlpro-0.2.0/go/internal/client/tlsconn_test.go +34 -0
  110. curlpro-0.2.0/go/internal/client/tlsfiles.go +103 -0
  111. curlpro-0.2.0/go/internal/client/websocket.go +780 -0
  112. curlpro-0.2.0/go/internal/client/wire_test.go +93 -0
  113. curlpro-0.2.0/go/internal/h3/README.md +122 -0
  114. curlpro-0.2.0/go/internal/h3/body.go +137 -0
  115. curlpro-0.2.0/go/internal/h3/client.go +623 -0
  116. curlpro-0.2.0/go/internal/h3/conn.go +338 -0
  117. curlpro-0.2.0/go/internal/h3/consts.go +22 -0
  118. curlpro-0.2.0/go/internal/h3/error.go +63 -0
  119. curlpro-0.2.0/go/internal/h3/error_codes.go +86 -0
  120. curlpro-0.2.0/go/internal/h3/fingerprint.go +111 -0
  121. curlpro-0.2.0/go/internal/h3/frames.go +360 -0
  122. curlpro-0.2.0/go/internal/h3/gzip_reader.go +39 -0
  123. curlpro-0.2.0/go/internal/h3/headers.go +420 -0
  124. curlpro-0.2.0/go/internal/h3/ip_addr.go +48 -0
  125. curlpro-0.2.0/go/internal/h3/order.go +96 -0
  126. curlpro-0.2.0/go/internal/h3/order_test.go +60 -0
  127. curlpro-0.2.0/go/internal/h3/qlog.go +56 -0
  128. curlpro-0.2.0/go/internal/h3/request_writer.go +352 -0
  129. curlpro-0.2.0/go/internal/h3/state_tracking_stream.go +173 -0
  130. curlpro-0.2.0/go/internal/h3/stream.go +408 -0
  131. curlpro-0.2.0/go/internal/h3/trace.go +121 -0
  132. curlpro-0.2.0/go/internal/h3/transport.go +561 -0
  133. curlpro-0.2.0/go/internal/profile/build.go +256 -0
  134. curlpro-0.2.0/go/internal/profile/json_probe_test.go +49 -0
  135. curlpro-0.2.0/go/internal/profile/profile.go +758 -0
  136. curlpro-0.2.0/go/internal/profile/profile_test.go +168 -0
  137. curlpro-0.2.0/go/internal/profile/quic.go +165 -0
  138. curlpro-0.2.0/go/internal/profile/quic_test.go +168 -0
  139. curlpro-0.2.0/go/internal/profile/spec.go +222 -0
  140. curlpro-0.2.0/go/internal/profile/trustanchors.go +147 -0
  141. curlpro-0.2.0/go/internal/profile/validate_test.go +199 -0
  142. curlpro-0.2.0/go/internal/qpack/decoder.go +637 -0
  143. curlpro-0.2.0/go/internal/qpack/decoder_test.go +207 -0
  144. curlpro-0.2.0/go/internal/qpack/static_table.go +261 -0
  145. curlpro-0.2.0/go/lib/async.go +275 -0
  146. curlpro-0.2.0/go/lib/curlpro.go +611 -0
  147. curlpro-0.2.0/go/lib/headers.go +76 -0
  148. curlpro-0.2.0/go/lib/stream.go +240 -0
  149. curlpro-0.2.0/go/lib/websocket.go +240 -0
  150. curlpro-0.2.0/pyproject.toml +55 -0
  151. curlpro-0.2.0/setup.cfg +4 -0
  152. curlpro-0.2.0/tests/test_alt_svc.py +144 -0
  153. curlpro-0.2.0/tests/test_async.py +167 -0
  154. curlpro-0.2.0/tests/test_async_stream.py +241 -0
  155. curlpro-0.2.0/tests/test_async_websocket.py +154 -0
  156. curlpro-0.2.0/tests/test_client_hints.py +234 -0
  157. curlpro-0.2.0/tests/test_compat.py +265 -0
  158. curlpro-0.2.0/tests/test_cookies.py +203 -0
  159. curlpro-0.2.0/tests/test_cookies_netscape.py +134 -0
  160. curlpro-0.2.0/tests/test_docs_parity.py +98 -0
  161. curlpro-0.2.0/tests/test_encoding_hooks.py +141 -0
  162. curlpro-0.2.0/tests/test_expectations.py +261 -0
  163. curlpro-0.2.0/tests/test_features.py +155 -0
  164. curlpro-0.2.0/tests/test_ffi_registry.py +153 -0
  165. curlpro-0.2.0/tests/test_ffi_version.py +47 -0
  166. curlpro-0.2.0/tests/test_h2_headers.py +108 -0
  167. curlpro-0.2.0/tests/test_http1.py +124 -0
  168. curlpro-0.2.0/tests/test_http3.py +88 -0
  169. curlpro-0.2.0/tests/test_keepalive.py +45 -0
  170. curlpro-0.2.0/tests/test_memory_switches.py +153 -0
  171. curlpro-0.2.0/tests/test_multipart.py +97 -0
  172. curlpro-0.2.0/tests/test_pool.py +99 -0
  173. curlpro-0.2.0/tests/test_protocol.py +150 -0
  174. curlpro-0.2.0/tests/test_proxy.py +123 -0
  175. curlpro-0.2.0/tests/test_readme_examples.py +226 -0
  176. curlpro-0.2.0/tests/test_resolve.py +79 -0
  177. curlpro-0.2.0/tests/test_response_limit.py +121 -0
  178. curlpro-0.2.0/tests/test_session_features.py +338 -0
  179. curlpro-0.2.0/tests/test_smoke.py +93 -0
  180. curlpro-0.2.0/tests/test_stream.py +90 -0
  181. curlpro-0.2.0/tests/test_timeout.py +122 -0
  182. curlpro-0.2.0/tests/test_upload.py +81 -0
  183. curlpro-0.2.0/tests/test_websocket.py +117 -0
  184. curlpro-0.2.0/tests/test_websocket_deflate.py +161 -0
  185. curlpro-0.2.0/tests/test_websocket_local.py +135 -0
curlpro-0.2.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 int3re
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
@@ -0,0 +1,9 @@
1
+ # Что кладётся в исходный архив сверх того, что setuptools берёт сам.
2
+ #
3
+ # Каталог go/ — не пакет Python, и без явного graft setuptools его не увидит:
4
+ # именно поэтому в архиве было ноль файлов Go, а обещание «соберёт нативную
5
+ # часть сам» не выполнялось. Каталог наполняется в .github/workflows/wheels.yml
6
+ # перед сборкой; в дереве репозитория его нет.
7
+ graft go
8
+ recursive-include curlpro/profiles *.json
9
+ include LICENSE NOTICE py.typed
curlpro-0.2.0/NOTICE ADDED
@@ -0,0 +1,29 @@
1
+ curlPro
2
+ Copyright 2026 int3re
3
+
4
+ Лицензия Apache 2.0, полный текст — в файле LICENSE.
5
+
6
+ Проект использует сторонний код; его лицензии перечислены ниже.
7
+
8
+ Зависимости (подключаются модулем Go, в репозитории не хранятся):
9
+ github.com/refraction-networking/utls — BSD-3-Clause
10
+ github.com/refraction-networking/uquic — BSD-3-Clause и MIT
11
+ github.com/bogdanfinn/fhttp — BSD-3-Clause
12
+ github.com/quic-go/qpack — MIT
13
+ github.com/klauspost/compress — Apache-2.0, BSD-3-Clause, MIT
14
+ github.com/andybalholm/brotli — MIT
15
+ golang.org/x/net, golang.org/x/crypto — BSD-3-Clause
16
+ gopkg.in/yaml.v3 — MIT и Apache-2.0
17
+
18
+ Код, скопированный в этот репозиторий:
19
+ internal/h3/ — копия http3 из github.com/refraction-networking/uquic
20
+ (BSD-3-Clause и MIT). Список правок против исходной
21
+ версии — в internal/h3/README.md
22
+ internal/qpack/static_table.go
23
+ — статическая таблица из github.com/quic-go/qpack (MIT)
24
+
25
+ Инструменты, которые скачиваются отдельно и в репозиторий не входят:
26
+ github.com/wi1dcard/fingerproxy (echo-server) — MIT
27
+
28
+ Профили браузеров в profiles/ получены двумя путями: собственными замерами
29
+ живых браузеров и импортом сигнатур curl-impersonate (MIT) — см. docs/.
curlpro-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,114 @@
1
+ Metadata-Version: 2.4
2
+ Name: curlpro
3
+ Version: 0.2.0
4
+ Summary: HTTP-клиент с сетевым отпечатком браузера: TLS ClientHello, кадры HTTP/2 и HTTP/3, порядок заголовков
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Source, https://github.com/int3re/curlpro
7
+ Project-URL: Issues, https://github.com/int3re/curlpro/issues
8
+ Project-URL: Changelog, https://github.com/int3re/curlpro/blob/main/ROADMAP.md
9
+ Keywords: tls,ja3,ja4,http2,http3,quic,fingerprint,impersonate,scraping
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Go
17
+ Classifier: Topic :: Internet :: WWW/HTTP
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Classifier: Operating System :: OS Independent
20
+ Requires-Python: >=3.9
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ License-File: NOTICE
24
+ Dynamic: license-file
25
+
26
+ # curlpro
27
+
28
+ HTTP-клиент с сетевым отпечатком браузера: TLS ClientHello, кадры HTTP/2,
29
+ порядок и регистр заголовков.
30
+
31
+ ```python
32
+ import curlpro
33
+
34
+ curlpro.load_profiles("profiles")
35
+
36
+ with curlpro.Session("chrome-151-windows") as s:
37
+ r = s.get("https://example.com")
38
+ print(r.status, r.text[:200])
39
+ ```
40
+
41
+ ## Зачем ещё один
42
+
43
+ Существующие решения хранят профили браузеров в компилируемом коде: новый Chrome
44
+ выходит каждые 4 недели, и каждый раз это правка C или Go, пересборка и релиз.
45
+ Здесь профиль — данные, и его можно подключить в рантайме:
46
+
47
+ ```python
48
+ curlpro.register_profile({
49
+ "name": "chrome-152-windows",
50
+ "based_on": "chrome-151-windows",
51
+ "headers": {"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) ... Chrome/152.0.0.0 ..."},
52
+ })
53
+ ```
54
+
55
+ ## Что внутри
56
+
57
+ Тонкая ctypes-обёртка над нативной библиотекой на Go: рукопожатие ведёт
58
+ [uTLS](https://github.com/refraction-networking/utls), HTTP/2 —
59
+ [fhttp](https://github.com/bogdanfinn/fhttp).
60
+
61
+ Отпечаток сверен с `tls.browserleaks.com`: Chrome 151 даёт
62
+ `t13d1516h2_8daaf6152771_806a8c22fdea` — тот же JA4, что живой браузер.
63
+
64
+ ## Границы
65
+
66
+ Библиотека закрывает сетевой слой. Она **не** подделывает JS-отпечаток
67
+ (canvas, WebGL, navigator) — это уровень браузера, там нужен Playwright.
68
+ Совпадение сетевого отпечатка необходимо, но не достаточно: современные
69
+ системы скорят JA4 вместе с JA4H, JA3S/JARM и поведенческим анализом.
70
+
71
+ Поддерживаются HTTP/1.1, HTTP/2, HTTP/3 и WebSocket, куки, редиректы, прокси
72
+ (HTTP CONNECT и SOCKS5), multipart, потоковое чтение и отправка, асинхронный API.
73
+
74
+ ```python
75
+ # WebSocket: рукопожатие по шаблону профиля браузера, permessage-deflate поддержан
76
+ with curlpro.Session() as s:
77
+ with s.websocket("wss://echo.websocket.org/", max_message_size=1 << 20) as ws:
78
+ ws.send("привет") # str → текстовый кадр
79
+ ws.send(b"\x00\xff") # bytes → двоичный
80
+ for message in ws: # до закрытия сервером — curlpro.WebSocketClosed;
81
+ print(message) # таймаут тишины — CurlProError с .code == "timeout"
82
+
83
+ # Большой файл уходит потоком, а не через память
84
+ with curlpro.Session() as s:
85
+ s.post("https://example.com/upload", body_file="archive.zip")
86
+
87
+ # Соединение переиспользуется между запросами, как у браузера.
88
+ # keep_alive=False даёт каждому запросу своё — нужно, когда балансировщик
89
+ # прибивает клиента к одному узлу
90
+ with curlpro.Session(keep_alive=False) as s:
91
+ s.get("https://example.com/")
92
+ ```
93
+
94
+ Отпечаток HTTP/3 сверен с Chrome 144 на `quic.browserleaks.com`:
95
+
96
+ ```python
97
+ with curlpro.Session("chrome-151-windows", http3=True) as s:
98
+ print(s.get("https://quic.browserleaks.com/fp").json()["h3_text"])
99
+ # 1:65536;6:262144;7:100;51:1;GREASE|GREASE|984832|m,a,s,p
100
+ ```
101
+
102
+ Динамическая таблица QPACK поддержана своим декодером: профиль объявляет
103
+ ёмкость, как Chrome, и ответ сервера, который ей пользуется, разбирается.
104
+
105
+ ## Установка
106
+
107
+ Пока собирается из исходников — нужны Go и C-компилятор:
108
+
109
+ ```powershell
110
+ .\build.ps1
111
+ cd python; $env:PYTHONPATH='.'; python -m pytest tests
112
+ ```
113
+
114
+ Библиотека ищется по `CURLPRO_LIBRARY`, затем в `curlpro/lib/`, затем в `dist/`.
@@ -0,0 +1,89 @@
1
+ # curlpro
2
+
3
+ HTTP-клиент с сетевым отпечатком браузера: TLS ClientHello, кадры HTTP/2,
4
+ порядок и регистр заголовков.
5
+
6
+ ```python
7
+ import curlpro
8
+
9
+ curlpro.load_profiles("profiles")
10
+
11
+ with curlpro.Session("chrome-151-windows") as s:
12
+ r = s.get("https://example.com")
13
+ print(r.status, r.text[:200])
14
+ ```
15
+
16
+ ## Зачем ещё один
17
+
18
+ Существующие решения хранят профили браузеров в компилируемом коде: новый Chrome
19
+ выходит каждые 4 недели, и каждый раз это правка C или Go, пересборка и релиз.
20
+ Здесь профиль — данные, и его можно подключить в рантайме:
21
+
22
+ ```python
23
+ curlpro.register_profile({
24
+ "name": "chrome-152-windows",
25
+ "based_on": "chrome-151-windows",
26
+ "headers": {"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) ... Chrome/152.0.0.0 ..."},
27
+ })
28
+ ```
29
+
30
+ ## Что внутри
31
+
32
+ Тонкая ctypes-обёртка над нативной библиотекой на Go: рукопожатие ведёт
33
+ [uTLS](https://github.com/refraction-networking/utls), HTTP/2 —
34
+ [fhttp](https://github.com/bogdanfinn/fhttp).
35
+
36
+ Отпечаток сверен с `tls.browserleaks.com`: Chrome 151 даёт
37
+ `t13d1516h2_8daaf6152771_806a8c22fdea` — тот же JA4, что живой браузер.
38
+
39
+ ## Границы
40
+
41
+ Библиотека закрывает сетевой слой. Она **не** подделывает JS-отпечаток
42
+ (canvas, WebGL, navigator) — это уровень браузера, там нужен Playwright.
43
+ Совпадение сетевого отпечатка необходимо, но не достаточно: современные
44
+ системы скорят JA4 вместе с JA4H, JA3S/JARM и поведенческим анализом.
45
+
46
+ Поддерживаются HTTP/1.1, HTTP/2, HTTP/3 и WebSocket, куки, редиректы, прокси
47
+ (HTTP CONNECT и SOCKS5), multipart, потоковое чтение и отправка, асинхронный API.
48
+
49
+ ```python
50
+ # WebSocket: рукопожатие по шаблону профиля браузера, permessage-deflate поддержан
51
+ with curlpro.Session() as s:
52
+ with s.websocket("wss://echo.websocket.org/", max_message_size=1 << 20) as ws:
53
+ ws.send("привет") # str → текстовый кадр
54
+ ws.send(b"\x00\xff") # bytes → двоичный
55
+ for message in ws: # до закрытия сервером — curlpro.WebSocketClosed;
56
+ print(message) # таймаут тишины — CurlProError с .code == "timeout"
57
+
58
+ # Большой файл уходит потоком, а не через память
59
+ with curlpro.Session() as s:
60
+ s.post("https://example.com/upload", body_file="archive.zip")
61
+
62
+ # Соединение переиспользуется между запросами, как у браузера.
63
+ # keep_alive=False даёт каждому запросу своё — нужно, когда балансировщик
64
+ # прибивает клиента к одному узлу
65
+ with curlpro.Session(keep_alive=False) as s:
66
+ s.get("https://example.com/")
67
+ ```
68
+
69
+ Отпечаток HTTP/3 сверен с Chrome 144 на `quic.browserleaks.com`:
70
+
71
+ ```python
72
+ with curlpro.Session("chrome-151-windows", http3=True) as s:
73
+ print(s.get("https://quic.browserleaks.com/fp").json()["h3_text"])
74
+ # 1:65536;6:262144;7:100;51:1;GREASE|GREASE|984832|m,a,s,p
75
+ ```
76
+
77
+ Динамическая таблица QPACK поддержана своим декодером: профиль объявляет
78
+ ёмкость, как Chrome, и ответ сервера, который ей пользуется, разбирается.
79
+
80
+ ## Установка
81
+
82
+ Пока собирается из исходников — нужны Go и C-компилятор:
83
+
84
+ ```powershell
85
+ .\build.ps1
86
+ cd python; $env:PYTHONPATH='.'; python -m pytest tests
87
+ ```
88
+
89
+ Библиотека ищется по `CURLPRO_LIBRARY`, затем в `curlpro/lib/`, затем в `dist/`.
@@ -0,0 +1,61 @@
1
+ """curlpro — an HTTP client with a browser's network fingerprint.
2
+
3
+ import curlpro
4
+
5
+ curlpro.load_profiles("profiles")
6
+ r = curlpro.get("https://example.com", impersonate="chrome-151-windows")
7
+ print(r.status, r.text[:200])
8
+
9
+ A profile can also be added at runtime, without waiting for a library
10
+ release::
11
+
12
+ curlpro.register_profile(json.load(open("chrome-152-windows.json")))
13
+
14
+ The library reproduces the network layer: the TLS ClientHello, HTTP/2 frames,
15
+ header order and case. The JavaScript fingerprint (canvas, WebGL, navigator)
16
+ belongs to the browser and is not covered here.
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ from ._ffi import HTTPError, Timeout, CurlProError, WebSocketClosed
22
+ from .expect import Expect, ExpectationFailed
23
+ from .aio import AsyncSession, AsyncStreamResponse, AsyncWebSocket
24
+ from .cookies import Cookie, Cookies
25
+ from .session import Redirect, Response, Session, delete, get, head, options, patch, post, put
26
+ from .profiles import Profile, ensure_loaded, list_profiles, load_profiles, register_profile
27
+ from .stream import StreamResponse
28
+ from .websocket import WebSocket
29
+
30
+ __all__ = [
31
+ "AsyncSession",
32
+ "AsyncStreamResponse",
33
+ "AsyncWebSocket",
34
+ "Cookie",
35
+ "Cookies",
36
+ "CurlProError",
37
+ "Expect",
38
+ "ExpectationFailed",
39
+ "HTTPError",
40
+ "Redirect",
41
+ "Timeout",
42
+ "Profile",
43
+ "Response",
44
+ "Session",
45
+ "StreamResponse",
46
+ "WebSocket",
47
+ "WebSocketClosed",
48
+ "delete",
49
+ "ensure_loaded",
50
+ "get",
51
+ "head",
52
+ "list_profiles",
53
+ "load_profiles",
54
+ "options",
55
+ "patch",
56
+ "post",
57
+ "put",
58
+ "register_profile",
59
+ ]
60
+
61
+ __version__ = "0.1.0"
@@ -0,0 +1,142 @@
1
+ """Collector of finished native calls.
2
+
3
+ An async request goes into a goroutine, and Python learns that it finished
4
+ from here. There is exactly one thread per process, no matter how many calls
5
+ are in flight: it waits inside the native part, where ctypes releases the
6
+ GIL, so the event loop keeps running.
7
+
8
+ The result itself is picked up by the event loop — that call is quick, just a
9
+ memory copy. Reaching into a loop from another thread is only allowed through
10
+ call_soon_threadsafe, and that is how the future is woken.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import asyncio
16
+ import threading
17
+ from typing import Any
18
+
19
+ from ._ffi import _call, _lib, call_framed_out
20
+
21
+ # How long a single wait inside the native part lasts. Waking up four times a
22
+ # second while idle costs nothing, and the thread exits almost immediately
23
+ # once nobody uses it any more.
24
+ _WAIT_MS = 250
25
+
26
+
27
+ class Completions:
28
+ """The single per-process collector of results."""
29
+
30
+ def __init__(self) -> None:
31
+ self._lock = threading.Lock()
32
+ self._waiters: dict[int, tuple[asyncio.AbstractEventLoop, asyncio.Future]] = {}
33
+ # Results that arrived before their waiter: the work can finish
34
+ # between the start call and register — routine for a stream read,
35
+ # which takes microseconds.
36
+ self._ready: dict[int, tuple[Any, bytes]] = {}
37
+ self._thread: threading.Thread | None = None
38
+ self._stop = False
39
+
40
+ def register(self, request_id: int, future: asyncio.Future) -> None:
41
+ loop = asyncio.get_running_loop()
42
+ with self._lock:
43
+ done = self._ready.pop(request_id, None)
44
+ if done is not None:
45
+ # Registration happens on the event loop, so the future can
46
+ # be completed right here, without call_soon_threadsafe.
47
+ future.set_result(done)
48
+ return
49
+ self._waiters[request_id] = (loop, future)
50
+ if self._thread is None or not self._thread.is_alive():
51
+ self._stop = False
52
+ self._thread = threading.Thread(
53
+ target=self._reap, name="curlpro-completions", daemon=True
54
+ )
55
+ self._thread.start()
56
+
57
+ def forget(self, request_id: int) -> None:
58
+ """Drops the wait: the call was cancelled and nobody needs its result."""
59
+ with self._lock:
60
+ self._waiters.pop(request_id, None)
61
+ self._ready.pop(request_id, None)
62
+
63
+ def _reap(self) -> None:
64
+ while True:
65
+ with self._lock:
66
+ if self._stop or not (self._waiters or self._ready):
67
+ self._thread = None
68
+ return
69
+ rid = int(_lib.curlpro_result_wait(_WAIT_MS))
70
+ if rid == 0:
71
+ continue
72
+ with self._lock:
73
+ entry = self._waiters.pop(rid, None)
74
+ if entry is None:
75
+ # No waiter yet. Work is started and registered in two
76
+ # steps, and a fast one — reading a chunk of the body —
77
+ # can finish in between. The result is set aside for
78
+ # register to pick up.
79
+ #
80
+ # It used to be thrown away here, and such a call hung
81
+ # forever: 24 concurrent stream reads lost one of them.
82
+ #
83
+ # It is taken under the same lock: otherwise register
84
+ # slips between the check and the hand-off, and the
85
+ # waiter and its ready result never meet again.
86
+ #
87
+ # A cancelled result never lands here: cancelling removes
88
+ # the call from the native registry, leaving nothing to take.
89
+ done = _take(rid)
90
+ if done is not None:
91
+ self._ready[rid] = done
92
+ continue
93
+ loop, future = entry
94
+ try:
95
+ loop.call_soon_threadsafe(_settle, future, rid)
96
+ except RuntimeError:
97
+ # The event loop is already closed — nobody to hand it to.
98
+ _take(rid)
99
+
100
+
101
+ def _take(request_id: int) -> tuple[Any, bytes] | None:
102
+ try:
103
+ return call_framed_out("curlpro_result_take", request_id)
104
+ except Exception: # noqa: BLE001 — already taken, or the session is closed
105
+ return None
106
+
107
+
108
+ def _settle(future: asyncio.Future, request_id: int) -> None:
109
+ """Runs on the event loop: takes the result and wakes the waiter."""
110
+ if future.done(): # the task was cancelled while the result was on its way
111
+ _take(request_id)
112
+ return
113
+ try:
114
+ payload, content = call_framed_out("curlpro_result_take", request_id)
115
+ except BaseException as exc: # noqa: BLE001 — hand the error to the waiter
116
+ future.set_exception(exc)
117
+ return
118
+ future.set_result((payload, content))
119
+
120
+
121
+ #: One instance per process: the native ready queue is single too.
122
+ completions = Completions()
123
+
124
+
125
+ async def settle(started: dict) -> tuple[Any, bytes]:
126
+ """Awaits the result of work already started: a request, a read, a receive.
127
+
128
+ Cancelling the task drops the wait and cancels the work natively. For a
129
+ request that frees the connection at once; for a stream read or a message
130
+ receive there is nothing to cancel — whatever was taken off the wire is
131
+ lost, which is why the stream or socket is closed after a cancellation.
132
+ """
133
+ request_id = int(started["request"])
134
+ loop = asyncio.get_running_loop()
135
+ future: asyncio.Future = loop.create_future()
136
+ completions.register(request_id, future)
137
+ try:
138
+ return await future
139
+ except asyncio.CancelledError:
140
+ completions.forget(request_id)
141
+ _call("curlpro_request_cancel", request_id)
142
+ raise