A Declarative HTTP Client for Python.
Low maintenance activity. Last release 18 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity and recent releases.
pip install uplinkUplink
- Builds Reusable Objects for Consuming Web APIs.
- Works with Requests, aiohttp, and Twisted.
- Inspired by Retrofit.
A Quick Walkthrough, with GitHub API v3
Uplink turns your HTTP API into a Python class.
from uplink import Consumer, get, Path, Query
class GitHub(Consumer):
"""A Python Client for the GitHub API."""
@get("users/{user}/repos")
def get_repos(self, user: Path, sort_by: Query("sort")):
"""Retrieves the user's public repositories."""
Build an instance to interact with the webservice.
github = GitHub(base_url="https://api.github.com/")
Then, executing an HTTP request is as simply as invoking a method.
repos = github.get_repos(user="octocat", sort_by="created")
The returned object is a friendly requests.Response:
