Client for Python Pydantic Responses API
Project description
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
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_pydantic_responses_python_sdk-1.0.0.tar.gz.
File metadata
- Download URL: python_pydantic_responses_python_sdk-1.0.0.tar.gz
- Upload date:
- Size: 51.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcac79374dc42886b357eb3ae7ce1c1eaba80f59b2604be38a3c8e4caf50ec53
|
|
| MD5 |
44ac3c3437a09306abb2dbb79d660952
|
|
| BLAKE2b-256 |
f9341d1973dc086536e7ecb504d357c1c69cc142568dad327a21cf9863e0661a
|
File details
Details for the file python_pydantic_responses_python_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: python_pydantic_responses_python_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 78.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fca10e8722e51dfbaa7ff9c7522b34efd823953d1952e21633496c0367974c3d
|
|
| MD5 |
af52f22920997f348289b96a2dbaf454
|
|
| BLAKE2b-256 |
3bc5c8817447f2717b13cfe7e485f4173f4df6a00e2a298123a6e852f24cfa4b
|