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-2022 Ithaka Harbors, Inc.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apiron-7.1.0.post2.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

apiron-7.1.0.post2-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file apiron-7.1.0.post2.tar.gz.

File metadata

  • Download URL: apiron-7.1.0.post2.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for apiron-7.1.0.post2.tar.gz
Algorithm Hash digest
SHA256 36990c590231b8c7626c190468c6100b5ac093fcde487d211513e5ac69cc9ffb
MD5 bf9aea89ebe52685472d59ea458c02a5
BLAKE2b-256 190253058569c141e434b6a7eae4a9487a1f088bb1b738e952a153c41bed3c51

See more details on using hashes here.

File details

Details for the file apiron-7.1.0.post2-py3-none-any.whl.

File metadata

  • Download URL: apiron-7.1.0.post2-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for apiron-7.1.0.post2-py3-none-any.whl
Algorithm Hash digest
SHA256 d8f4d235d77ea58c41307990fa0871a0c680c1e6da1bbe7375fb336ce92e18c2
MD5 ba16ee2f4899398288b9c702a4384973
BLAKE2b-256 3bca814078291f4c6097112a66ad38be46cda866c3e43deed7fd6eac1ed0fb04

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