A tool that can make GET and POST requests in parallel
Project description
English description follows Japanese.
概要
reqreq は、非常に簡潔な記述で複数の HTTP リクエスト(GET/POST)を並列に送信できる Python ライブラリです。サーバーとの通信を高速化したい場面で特に有効です。個人開発やスクリプト用途に適した設計で、直感的な構文が特徴です。
主な特徴
- 複数の HTTP リクエストを並列実行
- GET/POST を簡潔な記法で指定可能
- レスポンスの形式やエラー時の挙動を柔軟に制御可能
requestsモジュールとの互換性あり
主な用途
- Web サービスとの通信を高速化したいとき
- 複数個の API へ一括アクセスを行いたいとき
使い方
基本的な使い方(GET)
import reqreq
resp = reqreq(["https://example.com", "https://example-2.com"])
print(resp) # -> ['1つめのレスポンスの文字列', '2つめのレスポンスの文字列']
詳細な指定(GET/POST切り替え)
resp = reqreq([
{"url": "https://example.com", "method": "GET"},
{"url": "https://example.com", "method": "POST", "data": {"test": "test"}},
])
省略・簡易記法
resp = reqreq([
"https://example.com", # GET はURLだけでOK
["https://example.com", "POST", {"test": "test3"}], # リスト形式でも指定できる
("https://example.com", "POST", {"test": "test2"}), # タプル形式でも指定できる
["https://example.com", "post", {"test": "test3"}], # method名は小文字でもOK
])
オプション引数
resp = reqreq(
["https://example.com"],
resp_format = "raw", # "text" (デフォルト), または "raw" で requests.Response を取得
error = None, # 例外時に None を返す(デフォルト)
# error = "raw" にすると、例外オブジェクトをそのまま返す
)
注意点
- 非同期ライブラリではありません(内部ではスレッドベースの並列処理を行います)
- エラーハンドリングは簡易的で、例外を捕捉する場合は
error="raw"を明示してください - POST の
dataはrequestsと同様の形式で渡します
Overview
reqreq is a minimalistic Python library for sending multiple HTTP requests (GET/POST) in parallel with concise syntax. It’s designed for use cases where communication with web services needs to be fast, such as in personal projects or data scripts.
Features
- Parallel execution of multiple HTTP requests
- Extremely concise syntax for both GET and POST
- Customizable response format and error handling
- Compatible with
requestsresponse objects
Typical Use Cases
- Speeding up communication with your backend service
- Sending multiple API calls at once
Usage
Basic (GET requests)
import reqreq
resp = reqreq(["https://example.com", "https://example-2.com"])
print(resp) # -> ['Response from the first URL', 'Response from the second URL']
Detailed request specification
resp = reqreq([
{"url": "https://example.com", "method": "GET"},
{"url": "https://example.com", "method": "POST", "data": {"test": "test"}},
])
Compact notation
resp = reqreq([
"https://example.com", # Shorthand for GET
("https://example.com", "post", {"test": "test2"}), # Tuple style
["https://example.com", "POST", {"test": "test3"}], # List style also accepted
])
Additional options
resp = reqreq(
["https://example.com"],
resp_format = "raw", # "text" (default) or "raw" to get requests.Response objects
error = None, # Return None on error (default)
# error = "raw" returns the actual exception object
)
Notes
- This is not an async library; parallelism is thread-based.
- Error handling is simple; use
error="raw"if you want to inspect exceptions directly. - For POST data, use the same structure as the
requestslibrary.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reqreq-0.0.0.tar.gz.
File metadata
- Download URL: reqreq-0.0.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c9568057070d8bf656ad7d606d3a51252fe09e30c958165e0712ba99a5446ed
|
|
| MD5 |
6d8bd1cf3031ba01d98b28ace24f735a
|
|
| BLAKE2b-256 |
e6a80041cd8c9c9b0665681cac9005323adc584b400a83b455c253232f846234
|
File details
Details for the file reqreq-0.0.0-py3-none-any.whl.
File metadata
- Download URL: reqreq-0.0.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df8558c50e69ab50e045fe28a98097604816b869e43b515f36e1238817c5a9eb
|
|
| MD5 |
e51ef01998bbf1b1c6f39d5f4207f64e
|
|
| BLAKE2b-256 |
32e317091c045d5c32de01520339e7a91da5075dc11130df8a4e1d9e37142aa2
|