Skip to main content

apiron helps you cook a tasty client for RESTful APIs. Just don't wash it with SOAP.

Project description

apiron

PyPI version Supported Python versions Build Status Documentation Status Contributor Covenant

apiron helps you cook a tasty client for RESTful APIs. Just don't wash it with SOAP.

Pie in a cast iron skillet

Gathering data from multiple services has become a ubiquitous task for web application developers. The complexity can grow quickly: calling an API endpoint with multiple parameter sets, calling multiple API endpoints, calling multiple endpoints in multiple APIs. While the business logic can get hairy, the code to interact with those APIs doesn't have to.

apiron provides declarative, structured configuration of services and endpoints with a unified interface for interacting with them.

Defining a service

A service definition requires a domain and one or more endpoints with which to interact:

from apiron import JsonEndpoint, Service

class GitHub(Service):
    domain = 'https://api.github.com'
    user = JsonEndpoint(path='/users/{username}')
    repo = JsonEndpoint(path='/repos/{org}/{repo}')

Interacting with a service

Once your service definition is in place, you can interact with its endpoints:

response = GitHub.user(username='defunkt')
# {"name": "Chris Wanstrath", ...}

response = GitHub.repo(org='github', repo='hub')
# {"description": "hub helps you win at git.", ...}

To learn more about building clients, head over to the docs.

Contributing

We are happy to consider contributions via pull request, especially if they address an existing bug or vulnerability. Please read our contribution guidelines before getting started.

License

This package is available under the MIT license. For more information, view the full license and copyright notice.

Copyright 2018-2020 Ithaka Harbors, Inc.

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

apiron-5.1.0.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

apiron-5.1.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file apiron-5.1.0.tar.gz.

File metadata

  • Download URL: apiron-5.1.0.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.0

File hashes

Hashes for apiron-5.1.0.tar.gz
Algorithm Hash digest
SHA256 13a3acfb94fd3075132d4e4e8ccd215d46b4cfd8cbea20edc70a387d88c58be3
MD5 69a74668f1db8e54d112eb9d532e5c77
BLAKE2b-256 87605aaa9a046f9946b3f289062c1e8ecfe37e01320f1e4247a28fb94a152eda

See more details on using hashes here.

File details

Details for the file apiron-5.1.0-py3-none-any.whl.

File metadata

  • Download URL: apiron-5.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.0

File hashes

Hashes for apiron-5.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9d0c21bb09cf3592874755b27cf6bb52801e1cc32b080297d29276281904161
MD5 7672fd2f0d9a30b0bc7c2a89caeb0c8f
BLAKE2b-256 5a4c73a277eb8329cb0e7958087db1fa9ecc5122b91794df9b86769ac76074be

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