Skip to main content

oas-client

Generate typed python client from OpenAPI specification

Installation

You can install the package via pip:

pip install oas-client

Usage

Use this command to generate client.

oas-client <path_or_url>

To use the generate client,

from client.client import APIClient

client = APIClient(
    base_url="https://api.example.com",
    headers={
        "Authorization": "Bearer MY_SECRET_TOKEN",
    },
    # supports all configurations from httpx.Client
)
print(
    client.core_api_list_servers(
        follow_redirects=False,
        timeout=10,
        # supports all configurations from httpx request
    )
)

Why not pydantic?

Request bodies are meant to support partial data, especially in PATCH requests, which is not supported by pydantic model. So, we use TypedDict with NotRequired modifier.

class PartialUpdateAccountSchema(TypedDict):
    email: NotRequired[str]
    address: NotRequired[str]
    country: NotRequired[str]
    dob: NotRequired[str]

Why duplicate schemas in requests.py and responses.py?

There is a possibility of duplicate schemas for request body and reponse body because NotRequired modifier is necessary for only request body and is not relevant for respose body.

Limitations

  • Only supports OAS 3
  • No aysnc support

License

This project is licensed under the terms of the MIT license.

Metadata

Release files for oas-client 0.1.7

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

Source distribution (sdist)

Source distribution for oas-client 0.1.7
File Size Uploaded Provenance
oas_client-0.1.7.tar.gz 9.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for oas-client 0.1.7
File Interpreter ABI Platform
oas_client-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 20.9 kB

Release files / oas_client-0.1.7.tar.gz

Download URL oas_client-0.1.7.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
df205042c1e98569b713373db7d24fa0ac042864b3613ddac6f5409ec5d1ad7b
BLAKE2b-256 checksum
How to use checksums
27dc7adcdd98bf648ca845226b704b1b1c0b701c00254d28ead32cabf8c18f7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / oas_client-0.1.7-py3-none-any.whl

Download URL oas_client-0.1.7-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8fca714861f480507b9bbf6db903a575b61465cbef2b9c8ff8a78648688bb3c8
BLAKE2b-256 checksum
How to use checksums
c515423780e0af44eb9b2b96565f19fd830800522622c46d78ccab191eafe055
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Security for oas-client 0.1.7

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.

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