Skip to main content

reqrio-py

reqrio-py is the Python binding for reqrio, a lightweight and high-concurrency HTTP request library.

Features

  • High-performance HTTP/HTTPS request engine with low-copy semantics.
  • Built-in TLS support using BoringSSL.
  • Supports HTTP/1.1 and HTTP/2.0 via ALPN.
  • Supports custom headers, cookies, timeouts, proxies, and certificate verification.
  • Supports form data, JSON, text, bytes, and multipart file uploads.
  • Includes a WebSocket client wrapper.

Installation

pip install reqrio

Python 3.9 or newer is required.

Quick Start

import reqrio

session = reqrio.Session(
    headers={
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)...",
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
    },
    alpn=reqrio.ALPN.HTTP20,
    verify=True,
)

session.set_timeout(3000, 3000, 3000, 30000)

response = session.get("https://www.example.com")
print(response.statue_code())
print(response.text())

session.close()

API Reference

reqrio.Session

Create a session:

session = reqrio.Session(
    headers=None,
    alpn=reqrio.ALPN.HTTP11,
    verify=True,
    proxy=None,
    key_log=None,
    ja3=None,
    ja4=None,
    client_hello=None,
    random_tls=False,
    custom_tls=None,
    token="",
)

Common methods:

  • session.set_headers(headers: dict)
  • session.add_header(name: str, value: str)
  • session.remove_header(name: str)
  • session.set_timeout(connect, read, write, handle, connect_times=3, handle_times=3)
  • session.set_cookie(cookie: str)
  • session.add_cookie(name: str, value: str)
  • session.get(url, params=None, data=None, json=None, bytes=None, text=None, **kwargs)
  • session.post(url, params=None, data=None, json=None, bytes=None, text=None, **kwargs)
  • session.open_stream(method, url, params=None, data=None, json=None, bytes=None, text=None, **kwargs)
  • session.close()

Helper functions

reqrio also offers shortcut functions for single requests:

resp = reqrio.get(
    "https://www.example.com",
    headers={"User-Agent": "..."},
    params={"q": "test"},
)
print(resp.statue_code())

resp = reqrio.post(
    "https://www.example.com/api",
    headers={"Content-Type": "application/json"},
    json={"key": "value"},
)
print(resp.statue_code())

WebSocket support

from reqrio import WebSocket, WsOpCode

headers = {
    "Origin": "https://example.com",
    "User-Agent": "Mozilla/5.0...",
}

ws = WebSocket(
    "wss://example.com/",
    uri="wss://example.com/api/ws",
    headers=headers,
)
ws.open()

while True:
    frame = ws.read()
    if frame.opcode == WsOpCode.PING:
        ws.write(WsOpCode.PONG, frame.payload)
    else:
        print(frame.payload.decode("utf-8"))

ws.close()

Request Body Types

Supported request bodies:

  • data={...} for form data
  • json={...} for JSON payloads
  • text="..." for plain text
  • bytes=b"..." for raw bytes
  • files=[...] for multipart file upload

File upload example:

files = [
    {
        "path": "./example.txt",
        "field_name": "file",
        "filetype": "text/plain",
    }
]

response = session.post(
    "https://www.example.com/upload",
    data={"name": "test"},
    files=files,
)
print(response.statue_code())

TLS Fingerprinting and Advanced Options

reqrio.Session supports advanced TLS configuration:

  • ja3: JA3 fingerprint string
  • ja4: JA4 fingerprint string
  • client_hello: raw TLS ClientHello bytes
  • random_tls: random TLS fingerprint
  • custom_tls: custom TLS configuration dictionary
  • token: fingerprint authentication token

Additional options:

  • verify=False to disable certificate verification
  • proxy for HTTP/SOCKS proxy support
  • key_log to save TLS key material for debugging

Notes

  • reqrio-py is designed to reuse connections when possible.
  • Be sure to call session.close() to release resources.

License

Apache-2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reqrio-0.3.1.tar.gz (3.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reqrio-0.3.1-py3-none-any.whl (3.6 MB view details)

Uploaded Python 3

File details

Details for the file reqrio-0.3.1.tar.gz.

File metadata

  • Download URL: reqrio-0.3.1.tar.gz
  • Upload date:
  • Size: 3.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for reqrio-0.3.1.tar.gz
Algorithm Hash digest
SHA256 12383a85ab942ca04c685fc2518e63d253869db7fd4022bb645ef657ee34fe26
MD5 3c2f790a91ac02400c1d37f60c0bbf1f
BLAKE2b-256 44d5d470f61a55efe0ab7a733760ee2eb1c6d6f8658ceb67f4149ab5ae1d5557

See more details on using hashes here.

File details

Details for the file reqrio-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: reqrio-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for reqrio-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 62d000a93382f67a6313770c1de4effe0e7539c9fce9dfaab3283b2535f29ef1
MD5 e4d0bc53bf66956f0ef3aed82db9fd18
BLAKE2b-256 29db92b47d76fb89e7f56d0e90adebefad80fc76c030f3a4c45e69326939aee0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 files

0.3.0

2 files

0.2.0

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.20

2 files

0.0.19

2 files

0.0.18

2 files

0.0.16

2 files

0.0.14

2 files

0.0.13

2 files

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page