python-pydantic-responses-python-sdk
A simple API based on python pydantic responses.
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
🌐 Endpoint
/simple-endpoint get
pythonpydanticresponses.test.reserved_word
Reserved word in Python
🛠️ Usage
reserved_word_response = pythonpydanticresponses.test.reserved_word()
🔄 Return
🌐 Endpoint
/reserved-word get
Author
This Python package is automatically generated by Konfig
Release files for python-pydantic-responses-python-sdk 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python_pydantic_responses_python_sdk-1.0.0.tar.gz | 51.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_pydantic_responses_python_sdk-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:130.2 kB
Release files / python_pydantic_responses_python_sdk-1.0.0.tar.gz
| Download URL | python_pydantic_responses_python_sdk-1.0.0.tar.gz |
|---|---|
| Size | 51.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dcac79374dc42886b357eb3ae7ce1c1eaba80f59b2604be38a3c8e4caf50ec53
|
|
BLAKE2b-256 checksum How to use checksums |
f9341d1973dc086536e7ecb504d357c1c69cc142568dad327a21cf9863e0661a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.16
|
Release files / python_pydantic_responses_python_sdk-1.0.0-py3-none-any.whl
| Download URL | python_pydantic_responses_python_sdk-1.0.0-py3-none-any.whl |
|---|---|
| Size | 78.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fca10e8722e51dfbaa7ff9c7522b34efd823953d1952e21633496c0367974c3d
|
|
BLAKE2b-256 checksum How to use checksums |
3bc5c8817447f2717b13cfe7e485f4173f4df6a00e2a298123a6e852f24cfa4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.16
|