Skip to main content

Swagger Petstore - OpenAPI 3.0 SDK

Built with APIMatic License: MIT Python 3.10+

The Swagger Petstore - OpenAPI 3.0 SDK for Python provides access to the Swagger Petstore - OpenAPI 3.0 REST APIs from Python applications.

This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about Swagger at https://swagger.io. In the third iteration of the pet store, we've switched to the design first approach! You can now help us improve the API whether it's by making changes to the definition itself or to the code. That way, with time, we can improve the API in general, and expose some of the new features in OAS3.

Some useful links:


Installation

To install the Python SDK from PyPI, with whichever package manager your project uses:

pip install wesley-key-sdk
uv add wesley-key-sdk
poetry add wesley-key-sdk

To install from the SDK source instead, give the tool a path containing a slash — a bare folder name is looked up on PyPI, and resolves to whatever project holds that name there:

pip install <path-to-sdk>

Quick Start

Synchronous client

Construct SwaggerPetstoreOpenApi30Client with keyword arguments, and call close() when you are done. Every argument is optional; the full list is in the SDK map.

from swagger_petstore_open_api_3_0 import SwaggerPetstoreOpenApi30Client

client = SwaggerPetstoreOpenApi30Client(petstore_auth="YOUR_API_KEY", api_key="YOUR_API_KEY")

# TODO: call endpoints here -- see api-reference.md

client.close()

Alternatively, scope it -- with SwaggerPetstoreOpenApi30Client(...) as client: closes the pool on exit; see Best Practices.

Client is exported as an alias of SwaggerPetstoreOpenApi30Client, so from swagger_petstore_open_api_3_0 import Client also works.

The SDK accepts every model-typed input in two interchangeable spellings, both type-checked: the typed model, or a plain dict with the same keys -- the OrDict and Model | ModelDict unions in the SDK map. Pick whichever suits the call site: the dict form needs no import, while the model form adds a keyword-checked constructor and editor completion.

Asynchronous client

AsyncSwaggerPetstoreOpenApi30Client mirrors SwaggerPetstoreOpenApi30Client with identical method names, and every endpoint method is a coroutine. It takes the same arguments, with some differences -- for example, the transport argument is custom_async_http_client.

from asyncio import run

from swagger_petstore_open_api_3_0 import AsyncSwaggerPetstoreOpenApi30Client


async def main() -> None:
    client = AsyncSwaggerPetstoreOpenApi30Client(petstore_auth="YOUR_API_KEY", api_key="YOUR_API_KEY")
    # TODO: call endpoints here, awaiting each -- see api-reference.md
    await client.aclose()


run(main())

Alternatively, scope it -- async with AsyncSwaggerPetstoreOpenApi30Client(...) as client: closes the pool on exit. Only the async spelling is aclose, matching httpx2; see Best Practices.

AsyncClient is the exported alias. Each client accepts only its own transport argument; passing the other's is a TypeError at runtime and an error under mypy.


Usage

Two generated references cover the SDK; each answers a different question:

Reference For
API Reference Usage guidance for a single parsed operation: client.<group>.<operation>(...) returns the typed payload and raises ApiError on any non-2xx, with .error the typed error body, or RawError for a status the operation does not document.
Raw API Reference The same for the raw variant: client.<group>.with_raw_response.<operation>(...) returns ApiResult[T, E] and never raises for an API error.

Both API references carry every one of the 19 operations, with a sync and an async sample and a parameter table each.

SDK map

This SDK ships a generated SDK map -- sdk-map.md -- a deterministic, lookup-oriented table of contents of the SDK's Python surface, generated by APIMatic alongside this SDK.

Consult the map before scanning or grepping the source: it answers call-level contract questions by lookup, and for anything it does not carry -- model shapes, enum values, an endpoint's route or behavioural prose -- it names the one source file to read. How to read the map itself, including the SDK-wide defaults its rows rely on, is stated at the top of sdk-map.md.

Best Practices

Match the disposal to the client's lifetime: an application-lifetime client is closed once at shutdown with close() / aclose(); where the lifetime fits a block, with SwaggerPetstoreOpenApi30Client() as client: / async with AsyncSwaggerPetstoreOpenApi30Client() as client: releases it automatically. Both are idempotent, but a closed client is not reusable: the next call raises. The client closes whatever transport it holds, including one you supplied via custom_http_client / custom_async_http_client; if you intend to reuse your own transport across clients, don't hand its lifetime to a with block.

Retries are on by default: a failed idempotent request — a retryable status or no response at all — is sent again up to three times before the call gives up. Pass retry_options=0 to turn it off, for instance in a test that stubs an error response; the policy and its defaults are under Retries in the SDK map.

License

This SDK is distributed under the MIT License.


Support

Refer to the API reference for detailed information on available operations with code samples.

For further assistance, please contact support at apiteam@swagger.io.


Metadata

Release files for wesley-key-sdk 0.0.9

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

Source distribution (sdist)

Source distribution for wesley-key-sdk 0.0.9
File Size Uploaded
wesley_key_sdk-0.0.9.tar.gz 125.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wesley-key-sdk 0.0.9
File Interpreter ABI Platform
wesley_key_sdk-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 295.4 kB

Release files / wesley_key_sdk-0.0.9.tar.gz

Download URL wesley_key_sdk-0.0.9.tar.gz
Size 125.0 kB
Tags Source
SHA-256 checksum
How to use checksums
35188f55959c49c746fd129d7bbba4d986ad1ef5570e28b53cf4024ddbcf4942
BLAKE2b-256 checksum
How to use checksums
d422694d0249d525ef8b683b7f2b5bf7cb2d0189c96d516abf2cdf689aa87256
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.13.15 Linux/6.1.158.2-microsoft-standard

Release files / wesley_key_sdk-0.0.9-py3-none-any.whl

Download URL wesley_key_sdk-0.0.9-py3-none-any.whl
Size 170.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa8d1c7bb063a779c1bcb033cbfcd7b2033ea988697058cfcdbbf1aa428c46c6
BLAKE2b-256 checksum
How to use checksums
2a3bac998fb82d1bee7f7fc90a45dc528daf2fb8034a0ad4bee39a40a6061ba1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.13.15 Linux/6.1.158.2-microsoft-standard

Release history Release notifications | RSS feed

4.2.0

2 release files

3.0.7

2 release files

3.0.6

2 release files

3.0.5

2 release files

3.0.4

2 release files

3.0.3

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.3

2 release files

0.1.2

2 release files

This release

0.0.9 This release

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