never-primp 2.1.7__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 (46) hide show
  1. never_primp-2.1.7/.claude/settings.local.json +42 -0
  2. never_primp-2.1.7/.github/workflows/build.yml +247 -0
  3. never_primp-2.1.7/.gitignore +79 -0
  4. never_primp-2.1.7/Cargo.lock +1875 -0
  5. never_primp-2.1.7/Cargo.toml +68 -0
  6. never_primp-2.1.7/LICENSE +21 -0
  7. never_primp-2.1.7/PKG-INFO +1071 -0
  8. never_primp-2.1.7/RANDOM_IMPERSONATE_FEATURE.md +343 -0
  9. never_primp-2.1.7/README.md +1043 -0
  10. never_primp-2.1.7/SPLIT_COOKIES.md +346 -0
  11. never_primp-2.1.7/benchmark.py +227 -0
  12. never_primp-2.1.7/benchmark_results.png +0 -0
  13. never_primp-2.1.7/example/example_advanced.py +306 -0
  14. never_primp-2.1.7/example/example_async.py +401 -0
  15. never_primp-2.1.7/example/example_basic.py +18 -0
  16. never_primp-2.1.7/example/example_multithreading.py +357 -0
  17. never_primp-2.1.7/example/example_random_impersonate.py +190 -0
  18. never_primp-2.1.7/example/example_real_world.py +541 -0
  19. never_primp-2.1.7/example/main.rs +94 -0
  20. never_primp-2.1.7/example/test_headers_order.py +106 -0
  21. never_primp-2.1.7/example/test_random_impersonate.py +214 -0
  22. never_primp-2.1.7/never_primp/__init__.py +785 -0
  23. never_primp-2.1.7/never_primp/_random_presets.py +135 -0
  24. never_primp-2.1.7/never_primp/_types.py +195 -0
  25. never_primp-2.1.7/never_primp/never_primp.pyi +688 -0
  26. never_primp-2.1.7/never_primp/py.typed +0 -0
  27. never_primp-2.1.7/pyproject.toml +53 -0
  28. never_primp-2.1.7/src/config/dns.rs +35 -0
  29. never_primp-2.1.7/src/config/http.rs +68 -0
  30. never_primp-2.1.7/src/config/http2.rs +178 -0
  31. never_primp-2.1.7/src/config/mod.rs +165 -0
  32. never_primp-2.1.7/src/config/pool.rs +51 -0
  33. never_primp-2.1.7/src/config/proxy.rs +229 -0
  34. never_primp-2.1.7/src/config/tcp.rs +130 -0
  35. never_primp-2.1.7/src/config/timeout.rs +64 -0
  36. never_primp-2.1.7/src/config/tls.rs +79 -0
  37. never_primp-2.1.7/src/error.rs +510 -0
  38. never_primp-2.1.7/src/impersonate.rs +243 -0
  39. never_primp-2.1.7/src/lib.rs +1559 -0
  40. never_primp-2.1.7/src/response.rs +244 -0
  41. never_primp-2.1.7/src/traits.rs +106 -0
  42. never_primp-2.1.7/src/utils.rs +70 -0
  43. never_primp-2.1.7/test.py +45 -0
  44. never_primp-2.1.7/test_content_length_order.py +118 -0
  45. never_primp-2.1.7/tests/test_dns_cache.py +238 -0
  46. never_primp-2.1.7/tests/test_http2_params.py +280 -0
@@ -0,0 +1,42 @@
1
+ {
2
+ "env": {
3
+ "MAX THINKING TOKENS": "32000"
4
+ },
5
+ "permissions": {
6
+ "allow": [
7
+ "Bash(findstr:*)",
8
+ "Bash(maturin develop --release)",
9
+ "Bash(python test_ua_override.py:*)",
10
+ "Bash(python test_headers_debug.py:*)",
11
+ "Bash(python test_headers.py:*)",
12
+ "Bash(python test_fingerprint.py:*)",
13
+ "Bash(python example_basic.py:*)",
14
+ "Bash(python test_random_impersonate.py:*)",
15
+ "Bash(python example_random_impersonate.py:*)",
16
+ "Bash(python:*)",
17
+ "WebFetch(domain:tls.peet.ws)",
18
+ "WebFetch(domain:www.chromium.org)",
19
+ "WebSearch",
20
+ "Bash(cargo build:*)",
21
+ "Bash(cargo check:*)",
22
+ "Bash(cmd /c \"cd /d G:\\rust_p\\wreq-util && cargo check 2>&1\")",
23
+ "Bash(maturin develop:*)",
24
+ "Bash(where:*)",
25
+ "WebFetch(domain:github.com)",
26
+ "Bash(cmd /c \"G: && cd \\never_primp && python test_binary_data.py\")",
27
+ "WebFetch(domain:seanmonstar.com)",
28
+ "Bash(find:*)",
29
+ "Bash(cd /d G:never_primp)",
30
+ "Bash(cmd /c \"G: && cd \\never_primp && maturin develop --release 2>&1\")",
31
+ "Bash(G:)",
32
+ "WebFetch(domain:crates.io)",
33
+ "WebFetch(domain:scrapfly.io)",
34
+ "WebFetch(domain:raw.githubusercontent.com)",
35
+ "Bash(cd:*)",
36
+ "Bash(dir:*)",
37
+ "Bash(cmd /c \"cd /d G:\\never_primp && cargo check 2>&1\")"
38
+ ],
39
+ "deny": [],
40
+ "ask": []
41
+ }
42
+ }
@@ -0,0 +1,247 @@
1
+ name: Build and Publish never_primp
2
+
3
+ on:
4
+ # 手动触发工作流
5
+ workflow_dispatch:
6
+ inputs:
7
+ publish_to_pypi:
8
+ description: '是否发布到 PyPI (true/false)'
9
+ required: true
10
+ default: 'false'
11
+ type: choice
12
+ options:
13
+ - 'false'
14
+ - 'true'
15
+
16
+ # 推送触发:tag 或分支
17
+ push:
18
+ tags:
19
+ - 'v*.*.*'
20
+ branches:
21
+ - main
22
+ - master
23
+
24
+ permissions:
25
+ contents: read
26
+
27
+ jobs:
28
+ # ==================== Linux 平台构建 ====================
29
+ build-linux:
30
+ name: Build Linux ${{ matrix.target }}
31
+ runs-on: ubuntu-latest
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ target:
36
+ - x86_64 # Linux x64 (最常用)
37
+ # - aarch64 # Linux ARM64 (服务器)
38
+ steps:
39
+ - uses: actions/checkout@v4
40
+
41
+ - uses: actions/setup-python@v5
42
+ with:
43
+ python-version: '3.10'
44
+
45
+ - name: Install dependencies
46
+ run: |
47
+ sudo apt-get update
48
+ sudo apt-get install -y \
49
+ libclang-dev \
50
+ clang \
51
+ cmake \
52
+ build-essential \
53
+ pkg-config \
54
+ gcc-multilib \
55
+ libssl-dev
56
+
57
+ - name: Find and set libclang path
58
+ run: |
59
+ # 查找 libclang.so 并设置环境变量
60
+ LIBCLANG_PATH=$(find /usr/lib -name "libclang.so*" | head -1 | xargs dirname)
61
+ echo "LIBCLANG_PATH=$LIBCLANG_PATH" >> $GITHUB_ENV
62
+ echo "Found libclang at: $LIBCLANG_PATH"
63
+ ls -la $LIBCLANG_PATH/libclang.so* || true
64
+
65
+ - name: Build wheels
66
+ uses: PyO3/maturin-action@v1
67
+ with:
68
+ target: ${{ matrix.target }}
69
+ args: --release --out dist --find-interpreter
70
+ sccache: 'true'
71
+ manylinux: ${{ matrix.target == 'x86_64' && '2_28' || '2_28' }}
72
+ before-script-linux: |
73
+ # 检测包管理器并安装依赖
74
+ if command -v yum &> /dev/null; then
75
+ echo "Using yum (manylinux container)"
76
+ yum install -y clang llvm-devel cmake glibc-devel glibc-headers kernel-headers
77
+
78
+ # 设置 bindgen 的 clang 参数,确保能找到系统头文件
79
+ ARCH=$(uname -m)
80
+ export BINDGEN_EXTRA_CLANG_ARGS="-I/usr/include -I/usr/include/$ARCH-linux-gnu"
81
+ echo "BINDGEN_EXTRA_CLANG_ARGS=$BINDGEN_EXTRA_CLANG_ARGS"
82
+
83
+ # 查找并设置 libclang
84
+ export LIBCLANG_PATH="${LIBCLANG_PATH:-$(find /usr/lib* -name "libclang.so*" 2>/dev/null | head -1 | xargs dirname 2>/dev/null || echo "/usr/lib64")}"
85
+ echo "Using LIBCLANG_PATH=$LIBCLANG_PATH"
86
+ else
87
+ echo "Not in manylinux container, using host dependencies"
88
+ fi
89
+
90
+ # 验证
91
+ ls -la $LIBCLANG_PATH/libclang* 2>/dev/null || echo "libclang not found, relying on system defaults"
92
+ clang --version 2>/dev/null || echo "clang not in PATH"
93
+
94
+ - name: List built wheels
95
+ run: ls -lh dist/
96
+
97
+ - name: Upload wheels
98
+ uses: actions/upload-artifact@v4
99
+ with:
100
+ name: wheels-linux-${{ matrix.target }}
101
+ path: dist
102
+
103
+ # ==================== Windows 平台构建 ====================
104
+ build-windows:
105
+ name: Build Windows ${{ matrix.target }}
106
+ runs-on: windows-latest
107
+ strategy:
108
+ fail-fast: false
109
+ matrix:
110
+ target: [x64]
111
+ steps:
112
+ - uses: actions/checkout@v4
113
+
114
+ - uses: actions/setup-python@v5
115
+ with:
116
+ python-version: '3.10'
117
+ architecture: ${{ matrix.target }}
118
+
119
+ - name: Build wheels
120
+ uses: PyO3/maturin-action@v1
121
+ with:
122
+ target: ${{ matrix.target }}
123
+ args: --release --out dist --find-interpreter
124
+ sccache: 'true'
125
+
126
+ - name: List built wheels
127
+ run: dir dist
128
+
129
+ - name: Debug wheel contents
130
+ shell: powershell
131
+ run: |
132
+ $wheel = Get-ChildItem dist\*.whl | Select-Object -First 1
133
+ Write-Host "=== Wheel contents ==="
134
+ python -m zipfile -l $wheel
135
+ Write-Host "`n=== Looking for never_primp files ==="
136
+ python -m zipfile -l $wheel | Select-String "never_primp"
137
+
138
+ - name: Upload wheels
139
+ uses: actions/upload-artifact@v4
140
+ with:
141
+ name: wheels-windows-${{ matrix.target }}
142
+ path: dist
143
+
144
+ # ==================== macOS 平台构建 ====================
145
+ build-macos:
146
+ name: Build macOS ${{ matrix.target }}
147
+ runs-on: macos-latest
148
+ strategy:
149
+ fail-fast: false
150
+ matrix:
151
+ target:
152
+ - x86_64 # Intel Mac
153
+ - aarch64 # Apple Silicon (M1/M2/M3)
154
+ steps:
155
+ - uses: actions/checkout@v4
156
+
157
+ - uses: actions/setup-python@v5
158
+ with:
159
+ python-version: '3.10'
160
+
161
+ - name: Build wheels
162
+ uses: PyO3/maturin-action@v1
163
+ with:
164
+ target: ${{ matrix.target }}
165
+ args: --release --out dist --find-interpreter
166
+ sccache: 'true'
167
+
168
+ - name: List built wheels
169
+ run: ls -lh dist/
170
+
171
+ - name: Upload wheels
172
+ uses: actions/upload-artifact@v4
173
+ with:
174
+ name: wheels-macos-${{ matrix.target }}
175
+ path: dist
176
+
177
+ # ==================== 构建源码分发包 ====================
178
+ build-sdist:
179
+ name: Build source distribution
180
+ runs-on: ubuntu-latest
181
+ steps:
182
+ - uses: actions/checkout@v4
183
+
184
+ - name: Build sdist
185
+ uses: PyO3/maturin-action@v1
186
+ with:
187
+ command: sdist
188
+ args: --out dist
189
+
190
+ - name: List sdist
191
+ run: ls -lh dist/
192
+
193
+ - name: Upload sdist
194
+ uses: actions/upload-artifact@v4
195
+ with:
196
+ name: wheels-sdist
197
+ path: dist
198
+
199
+ # ==================== 发布到 PyPI ====================
200
+ publish-to-pypi:
201
+ name: Publish to PyPI
202
+ runs-on: ubuntu-latest
203
+ needs: [build-linux, build-windows, build-macos, build-sdist]
204
+
205
+ steps:
206
+ - name: Download all artifacts
207
+ uses: actions/download-artifact@v4
208
+ with:
209
+ pattern: wheels-*
210
+ path: dist
211
+ merge-multiple: true
212
+
213
+ - name: List all packages
214
+ run: |
215
+ echo "========================================="
216
+ echo "📦 准备发布的所有包:"
217
+ echo "========================================="
218
+ ls -lh dist/
219
+ echo ""
220
+ echo "========================================="
221
+ echo "📋 包列表:"
222
+ echo "========================================="
223
+ for file in dist/*; do
224
+ echo " ✓ $(basename $file)"
225
+ done
226
+ echo ""
227
+ echo "========================================="
228
+
229
+ - name: Publish to PyPI
230
+ uses: PyO3/maturin-action@v1
231
+ env:
232
+ MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
233
+ with:
234
+ command: upload
235
+ args: --non-interactive --skip-existing dist/*
236
+
237
+ - name: Success message
238
+ run: |
239
+ echo "========================================="
240
+ echo "✅ 发布成功!"
241
+ echo "========================================="
242
+ echo "用户现在可以通过以下命令安装:"
243
+ echo " pip install never_primp"
244
+ echo ""
245
+ echo "查看项目:"
246
+ echo " https://pypi.org/project/never_primp/"
247
+ echo "========================================="
@@ -0,0 +1,79 @@
1
+ /target
2
+ /my_test
3
+ nul
4
+ .claude
5
+ CLAUDE.md
6
+ # Byte-compiled / optimized / DLL files
7
+ __pycache__/
8
+ .pytest_cache/
9
+ *.py[cod]
10
+
11
+ # C extensions
12
+ *.so
13
+
14
+ # Distribution / packaging
15
+ .Python
16
+ .venv/
17
+ env/
18
+ bin/
19
+ build/
20
+ develop-eggs/
21
+ dist/
22
+ eggs/
23
+ lib/
24
+ lib64/
25
+ parts/
26
+ sdist/
27
+ var/
28
+ include/
29
+ man/
30
+ venv/
31
+ *.egg-info/
32
+ .installed.cfg
33
+ *.egg
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+ pip-selfcheck.json
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .coverage
44
+ .cache
45
+ nosetests.xml
46
+ coverage.xml
47
+
48
+ # Translations
49
+ *.mo
50
+
51
+ # Mr Developer
52
+ .mr.developer.cfg
53
+ .project
54
+ .pydevproject
55
+
56
+ # Rope
57
+ .ropeproject
58
+
59
+ # Django stuff:
60
+ *.log
61
+ *.pot
62
+
63
+ .DS_Store
64
+
65
+ # Sphinx documentation
66
+ docs/_build/
67
+
68
+ # PyCharm
69
+ .idea/
70
+
71
+ # VSCode
72
+ .vscode/
73
+
74
+ # Pyenv
75
+ .python-version
76
+
77
+ # Ignore csv and jpg files in benchmark folder
78
+ benchmark/*.csv
79
+ benchmark/*.jpg