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 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-4.0.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

apiron-4.0.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: apiron-4.0.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1

File hashes

Hashes for apiron-4.0.0.tar.gz
Algorithm Hash digest
SHA256 42a89765b9b2bc86b95ff8700592d70040dceb59a082647b175bfe60ac2c47c5
MD5 dece06bf9168474f07111badb29e4915
BLAKE2b-256 70f9b768bf68c61017e84b9853948ce018c27d38087f937d98094bbbb1414c08

See more details on using hashes here.

File details

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

File metadata

  • Download URL: apiron-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1

File hashes

Hashes for apiron-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 989af3fca5b16cbeb167cab600c6496043d7a0a0d9fe3a6e5fd8ef2d7d9351a1
MD5 da397c096c8bd17f0da550c54eb4a946
BLAKE2b-256 8ce90a6b8da091453438afe3d4d5f2f2bf7241fd99dfd222ba581b97f84a311a

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