apiron helps you cook a tasty client for RESTful APIs. Just don't wash it with SOAP.
Project description
apiron
apiron
helps you cook a tasty client for RESTful APIs. Just don't wash it with SOAP.
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.
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
File details
Details for the file apiron-5.0.0.tar.gz
.
File metadata
- Download URL: apiron-5.0.0.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfd311d5b9d8b2978701a11cf36ea3495232e59422bd4295868946ee92048986 |
|
MD5 | 053cf7de3be9269751ce76ca9a2ba81c |
|
BLAKE2b-256 | 97112a62d53bb6bdd5bc799df33608f68cc974ebe3eee1f0d3852e05cfdf58ed |
File details
Details for the file apiron-5.0.0-py3-none-any.whl
.
File metadata
- Download URL: apiron-5.0.0-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c5bffdc21bda08923766fb1e66829f2ca980999fd0f247d004c1b810cf4cb2c |
|
MD5 | c1b8743241719f137a3c80e4ee9427b0 |
|
BLAKE2b-256 | 0b6049c0059981401288dbec7639d31ac2f6e46ddd2e238d4a4b7510e40ddc7c |