Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

CI Workflow Ruff Poetry

Overview

This project allows you to execute a list of http operations asynchronously from within an synchronous context.

It does not care whether you should do this. It simply allows you to do so if you desire.

Installing

The package is available via pip.

pip install zconcurrent

If you're not on Windows, install the uvloop extra to increase performance.

pip install "zconcurrent[uvloop]"

Usage

The package can be imported as shown:

from zconcurrent.zsession import zSession, RequestMap, RequestResults
Class Description
zSession Session object containing collection of requests to send
RequestMap Container object that stores all info about an individual request to send
RequestResults Container object that stores the request responses and any exceptions raised

Example

# Create RequestMap objects
req1 = RequestMap(
    url="https://baconipsum.com/api",
    httpOperation="GET",
    queryParams={"type": "meat-and-filler", "format": "json"},
)
req2 = RequestMap(
    url="https://baconipsum.com/api",
    httpOperation="GET",
    queryParams={"type": "all-meat", "format": "json"},
)
req3 = RequestMap(
    url="https://baconipsum.com/api",
    httpOperation="GET",
    queryParams={"type": "meat-and-filler", "format": "json"},
)

# Create zSession and call sendRequests()
session = zSession(requestMaps=[req1, req2, req3])
reqResps: RequestResults = session.sendRequests(return_exceptions=True)

# Handle exceptions raised for individual requests
if len(reqResps.taskExceptions) > 0:
    print("Handling exceptions")

# Handle responses for individual requests
for resp in requestResponses:
    httpVerb = resp.requestMap.httpOperation
    print(f"Evaluating response for {httpVerb} request to {resp.requestMap.url}")
    print(f"Status Code: {resp.statusCode}")
    if resp.body is not None:
        print(resp.body)

RequestMap Class

class RequestMap(msgspec.Struct):
    url: str
    httpOperation: Literal["GET", "POST", "PUT", "PATCH", "OPTIONS", "DELETE"]
    body: dict | None = None
    queryParams: dict[str, str] | None = None
    headers: dict[str, str] | None = None

RequestResponse Class

class RequestResponse(msgspec.Struct):
    requestMap: RequestMap
    statusCode: int
    body: dict | None = None

RequestResults Class

@dataclass
class RequestResults:
    requestResponses: list[RequestResponse]
    taskExceptions: list[BaseException]

Metadata

Release files for zconcurrent 0.0.2a0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zconcurrent 0.0.2a0
File Size Uploaded Provenance Actions
zconcurrent-0.0.2a0.tar.gz 4.0 kB Without provenance Details for zconcurrent-0.0.2a0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zconcurrent 0.0.2a0
File Interpreter ABI Platform Actions
zconcurrent-0.0.2a0-py3-none-any.whl Python 3 none any Details for zconcurrent-0.0.2a0-py3-none-any.whl

Total release size: 8.4 kB

Release files / zconcurrent-0.0.2a0.tar.gz

Download URL zconcurrent-0.0.2a0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
418b0ab0cff7f4bafc6f2c8ce9b4d30874df9112f45253579852615f5b31c0b1
BLAKE2b-256 checksum
How to use checksums
fe425c47afb64027263b12c3c5d199ecba1fb0797d4614c04b43a8deaa63cace
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / zconcurrent-0.0.2a0-py3-none-any.whl

Download URL zconcurrent-0.0.2a0-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf3c7b24f51c6f4dfe1baf27c1c801b59c6d1ad7d464ba5eead5bc67d792cf49
BLAKE2b-256 checksum
How to use checksums
3473d51e4d58652aaa9d0ca79a3498151b542d2082b517ad14810a0349814249
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Security for zconcurrent 0.0.2a0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
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