Skip to main content

Arrest is a wrapper of pydantic and httpx to make your REST api calls type-safe and structured

Project description

Arrest

Tests

Coverage

PyPi

Enable data validation for REST APIs.

Built on top of Pydantic and httpx. Arrest is like a postman client for your microservice apis. It provides a simple layer of Pydantic encapsulation over Httpx HTTP calls to ensure structural integrity of your api definitions in a single file, as well as provide Pydantic's strength of data validation.

Installation

pip install arrest

Getting Started

from arrest import Resource, Service
from arrest.exceptions import ArrestHTTPException


xyz_service = Service(
    name="xyz",
    url="http://www.xyz-service.default.local.cluster:80",
    resources=[
        Resource(
            route="/users",
            handlers=[
                ("GET", "/"),
                ("GET", "/{user_id:int}"),
                ("POST", "/")
            ]
        )
    ]
)

try:
    response = await xyz_service.users.get("/123")
except ArrestHTTPException as exc:
    logging.warning(f"{exc.status_code} {exc.data}")

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

arrest-0.1.4.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arrest-0.1.4-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file arrest-0.1.4.tar.gz.

File metadata

  • Download URL: arrest-0.1.4.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.13 Linux/6.2.0-1018-azure

File hashes

Hashes for arrest-0.1.4.tar.gz
Algorithm Hash digest
SHA256 395d7914c5509dcee2a49b718301d5deb1aad1dbd6990c7b935a93ecf053b9e2
MD5 1f1bbc233a55c3b3be9908d7e434f9bf
BLAKE2b-256 106f6aa05cdc34257d8cd62b47cdb16ed004df00059aa2f5a076c6c0d63cfa1c

See more details on using hashes here.

File details

Details for the file arrest-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: arrest-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.13 Linux/6.2.0-1018-azure

File hashes

Hashes for arrest-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8a5d012c9ef63478b3b5481ecc7bf720e421b17f0c4d845421820deba498e303
MD5 fe40a7345875359601c6eb4d1a05e450
BLAKE2b-256 2fc8ec5ff60a848a24d55a47f219a14fe53181219444b3b7abd40ec4ad18775a

See more details on using hashes here.

Supported by

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