rusty-req 0.1.9__cp37-abi3-win_amd64.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 rusty-req might be problematic. Click here for more details.

rusty_req/__init__.py ADDED
@@ -0,0 +1,5 @@
1
+ from .rusty_req import *
2
+
3
+ __doc__ = rusty_req.__doc__
4
+ if hasattr(rusty_req, "__all__"):
5
+ __all__ = rusty_req.__all__
Binary file
@@ -0,0 +1,133 @@
1
+ Metadata-Version: 2.4
2
+ Name: rusty-req
3
+ Version: 0.1.9
4
+ Classifier: Programming Language :: Python
5
+ Classifier: Programming Language :: Python :: 3
6
+ Classifier: Programming Language :: Rust
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Summary: High-performance async HTTP client built with Rust for Python.
10
+ Author-email: KAY53N <kaysen820@gmail.com>
11
+ License-Expression: MIT
12
+ Requires-Python: >=3.7
13
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
14
+ Project-URL: Homepage, https://github.com/KAY53N/rusty-req
15
+ Project-URL: Repository, https://github.com/KAY53N/rusty-req
16
+ Project-URL: Bug Tracker, https://github.com/KAY53N/rusty-req/issues
17
+ Project-URL: Documentation, https://github.com/KAY53N/rusty-req#readme
18
+
19
+ # rusty-req
20
+
21
+
22
+ 基于 Rust + Python 的高性能异步请求库,适用于需要批量发送 HTTP 请求的场景。通过 Rust 实现并发请求逻辑,并通过 [maturin](https://github.com/PyO3/maturin) 封装为 Python 模块,兼具性能与易用性。
23
+
24
+ ## 🔧 安装
25
+
26
+ ```bash
27
+ pip install rusty-req
28
+ ```
29
+
30
+ 或从源码构建:
31
+
32
+ ```bash
33
+ maturin build --release
34
+ pip install target/wheels/rusty_req-*.whl
35
+ ```
36
+
37
+ ## 🚀 功能特点
38
+
39
+ - 批量异步发送 HTTP 请求(支持 GET / POST)
40
+ - 支持自定义 headers / params / timeout / tag
41
+ - 支持全局超时时间控制(`total_timeout`)
42
+ - 返回响应内容、错误信息、Meta 数据
43
+ - 使用 Rust + Tokio 提升吞吐能力
44
+
45
+ ## 📦 使用示例
46
+
47
+ ```python
48
+ import asyncio
49
+ import time
50
+ import rusty_req
51
+
52
+ async def main():
53
+ requests = [
54
+ rusty_req.RequestItem(
55
+ url="https://httpbin.org/headers",
56
+ method="GET",
57
+ params=None,
58
+ timeout=3.0,
59
+ tag=f"test-get-{i}",
60
+ headers={
61
+ "Accept-Encoding": "gzip, deflate, br",
62
+ "Connection": "keep-alive",
63
+ "X-Test-Header": "ChatGPT"
64
+ }
65
+ )
66
+ for i in range(100)
67
+ ]
68
+
69
+ start = time.perf_counter()
70
+
71
+ rusty_req.set_debug(False)
72
+ responses = await rusty_req.fetch_requests(requests, total_timeout=5.0)
73
+ duration = time.perf_counter() - start
74
+
75
+ success = sum(1 for r in responses if not r["error"])
76
+ failure = len(responses) - success
77
+
78
+ print(f"✅ 成功请求数: {success}")
79
+ print(f"❌ 失败请求数: {failure}")
80
+ print(f"⏱️ 总耗时: {duration:.2f} 秒")
81
+
82
+ if __name__ == "__main__":
83
+ asyncio.run(main())
84
+ ```
85
+
86
+ ## 🧱 数据结构说明
87
+
88
+ ### `RequestItem` 参数
89
+
90
+ | 字段名 | 类型 | 必须 | 说明 |
91
+ |------------|------------------|------|----------------------------------------|
92
+ | `url` | `str` | ✅ | 请求地址 |
93
+ | `method` | `str` | ✅ | 请求方法(`"GET"` 或 `"POST"`) |
94
+ | `params` | `dict` / `None` | 否 | 查询参数(GET)或表单数据(POST) |
95
+ | `headers` | `dict` / `None` | 否 | 自定义请求头 |
96
+ | `timeout` | `float` | ✅ | 单个请求超时(秒) |
97
+ | `tag` | `str` | 否 | 标记请求的来源、编号等辅助信息 |
98
+
99
+ ### 返回格式
100
+
101
+ ```python
102
+ [
103
+ {
104
+ "response": str | None, # 成功时返回内容
105
+ "error": str | None, # 失败时错误信息
106
+ "meta": {
107
+ "tag": str,
108
+ "elapsed_ms": float # 请求耗时(毫秒)
109
+ }
110
+ },
111
+ ...
112
+ ]
113
+ ```
114
+
115
+ ## 📑 Headers 示例
116
+
117
+ ```python
118
+ RequestItem(
119
+ url="https://httpbin.org/headers",
120
+ method="GET",
121
+ headers={
122
+ "Accept-Encoding": "gzip, deflate, br",
123
+ "Connection": "keep-alive",
124
+ "X-Test-Header": "ChatGPT"
125
+ },
126
+ timeout=5.0
127
+ )
128
+ ```
129
+
130
+ ## 📄 License
131
+
132
+ MIT License
133
+
@@ -0,0 +1,5 @@
1
+ rusty_req-0.1.9.dist-info/METADATA,sha256=1QU7ZS0e8oTLC8cMjWlnzoBAT4phD7bNnMnY_iof3CA,3947
2
+ rusty_req-0.1.9.dist-info/WHEEL,sha256=XZXUFxQkYWm5vMGjMfsN8R5EnOptnqekKXcGX77ogY0,94
3
+ rusty_req/__init__.py,sha256=XfQUTvk1FFMD7UyS817WUsedia2I8IeuvVba4QktOX0,119
4
+ rusty_req/rusty_req.pyd,sha256=LDzmipRFR6wATW-bdgq-krMooV98FVfRVgWDnmk687M,3810304
5
+ rusty_req-0.1.9.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.9.2)
3
+ Root-Is-Purelib: false
4
+ Tag: cp37-abi3-win_amd64