Skip to main content

Client for Python Pydantic Responses API

Project description

python-pydantic-responses-python-sdk

A simple API based on python pydantic responses.

PyPI README.md More Info

Table of Contents

Requirements

Python >=3.7

Installing

pip install python-pydantic-responses-python-sdk==1.0.0

Getting Started

from pprint import pprint
from python_pydantic import PythonPydanticResponses, ApiException

pythonpydanticresponses = PythonPydanticResponses(
    api_key="YOUR_API_KEY",
)

try:
    # Fetches a JSON value based on input parameter
    fetch_response = pythonpydanticresponses.test.fetch(
        input_parameter="inputParameter_example",
    )
    print(fetch_response)
except ApiException as e:
    print("Exception when calling TestApi.fetch: %s\n" % e)
    pprint(e.body)
    if e.status == 400:
        pprint(e.body["error"])
    if e.status == 500:
        pprint(e.body["error"])
    pprint(e.headers)
    pprint(e.status)
    pprint(e.reason)
    pprint(e.round_trip_time)

Async

async support is available by prepending a to any method.

import asyncio
from pprint import pprint
from python_pydantic import PythonPydanticResponses, ApiException

pythonpydanticresponses = PythonPydanticResponses(
    api_key="YOUR_API_KEY",
)


async def main():
    try:
        # Fetches a JSON value based on input parameter
        fetch_response = await pythonpydanticresponses.test.afetch(
            input_parameter="inputParameter_example",
        )
        print(fetch_response)
    except ApiException as e:
        print("Exception when calling TestApi.fetch: %s\n" % e)
        pprint(e.body)
        if e.status == 400:
            pprint(e.body["error"])
        if e.status == 500:
            pprint(e.body["error"])
        pprint(e.headers)
        pprint(e.status)
        pprint(e.reason)
        pprint(e.round_trip_time)


asyncio.run(main())

Raw HTTP Response

To access raw HTTP response values, use the .raw namespace.

from pprint import pprint
from python_pydantic import PythonPydanticResponses, ApiException

pythonpydanticresponses = PythonPydanticResponses(
    api_key="YOUR_API_KEY",
)

try:
    # Fetches a JSON value based on input parameter
    fetch_response = pythonpydanticresponses.test.raw.fetch(
        input_parameter="inputParameter_example",
    )
    pprint(fetch_response.body)
    pprint(fetch_response.body["property_a"])
    pprint(fetch_response.body["property_b"])
    pprint(fetch_response.body["property_c"])
    pprint(fetch_response.headers)
    pprint(fetch_response.status)
    pprint(fetch_response.round_trip_time)
except ApiException as e:
    print("Exception when calling TestApi.fetch: %s\n" % e)
    pprint(e.body)
    if e.status == 400:
        pprint(e.body["error"])
    if e.status == 500:
        pprint(e.body["error"])
    pprint(e.headers)
    pprint(e.status)
    pprint(e.reason)
    pprint(e.round_trip_time)

Reference

pythonpydanticresponses.test.fetch

Provide an input parameter to receive a JSON value with properties.

🛠️ Usage

fetch_response = pythonpydanticresponses.test.fetch(
    input_parameter="inputParameter_example",
)

⚙️ Parameters

input_parameter: str

The input parameter to process.

🔄 Return

TestFetchResponse

🌐 Endpoint

/simple-endpoint get

🔙 Back to Table of Contents


pythonpydanticresponses.test.reserved_word

Reserved word in Python

🛠️ Usage

reserved_word_response = pythonpydanticresponses.test.reserved_word()

🔄 Return

TestReservedWord

🌐 Endpoint

/reserved-word get

🔙 Back to Table of Contents


Author

This Python package is automatically generated by Konfig

Project details


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

File details

Details for the file python_pydantic_responses_python_sdk-1.0.0.tar.gz.

File metadata

File hashes

Hashes for python_pydantic_responses_python_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 dcac79374dc42886b357eb3ae7ce1c1eaba80f59b2604be38a3c8e4caf50ec53
MD5 44ac3c3437a09306abb2dbb79d660952
BLAKE2b-256 f9341d1973dc086536e7ecb504d357c1c69cc142568dad327a21cf9863e0661a

See more details on using hashes here.

File details

Details for the file python_pydantic_responses_python_sdk-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for python_pydantic_responses_python_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fca10e8722e51dfbaa7ff9c7522b34efd823953d1952e21633496c0367974c3d
MD5 af52f22920997f348289b96a2dbaf454
BLAKE2b-256 3bc5c8817447f2717b13cfe7e485f4173f4df6a00e2a298123a6e852f24cfa4b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page