Package: cognifloyd-uplink
Builds Reusable Objects for Consuming Web APIs.Works withRequests,aiohttp, andTwisted.Inspired byRetrofit.A Quick Walkthrough, with GitHub API v3Uplink turns your HTTP API into a Python class.fromuplinkimportConsumer,get,Path,QueryclassGitHub(Consumer):"""A Python Client for the GitHub API."""@get("users/{user}/repos")defget_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 friendlyrequests.Response:print(repos.json())# Output: [{'id': 64778136, 'name': 'linguist', ...For sending non-blocking requests, Uplink comes with support foraiohttpandtwisted.Ready to launch your first API client with Uplink? Start with thisquick tutorial!FeaturesQuickly Define Structured API ClientsUse decorators and type hints to describe each HTTP requestJSON, URL-encoded, and multipart request body and file uploadURL parameter replacement, request headers, and query parameter supportBring Your Own HTTP LibraryNon-blocking I/O supportfor Aiohttp and TwistedSupply your own session(e.g.,requests.Session) for greater controlEasy and Transparent Deserialization/SerializationDefinecustom convertersfor your own objectsSupport formarshmallowschemas andhandling collections(e.g., list of Users)ExtendableInstall optional plugins for additional features (e.g.,protobuf support)Composecustom response and error handlingfunctions as middlewareAuthenticationBuilt-in support forBasic AuthenticationUse existing auth libraries for supported clients (e.g.,requests-oauthlib)Uplink officially supports Python 2.7 & 3.3-3.7.InstallationTo install the latest stable release, you can usepip(orpipenv):$ pip install -U uplinkIf you are interested in the cutting-edge, preview the upcoming release with:$ pip install https://github.com/prkumar/uplink/archive/master.zipExtra! Extra!Further, uplink has optional integrations and features. You can view a full list
of available extrashere.When installing Uplink withpip, you can select extras using the format:$ pip install -U uplink[extra1, extra2, ..., extraN]For instance, to installaiohttpandmarshmallowsupport:$ pip install -U uplink[aiohttp, marshmallow]User TestimonialsMichael Kennedy(@mkennedy), host ofTalk PythonandPython Bytespodcasts-Of course our first reaction when consuming HTTP resources in Python is to
reach for Requests. But forstructuredAPIs, we often want more than ad-hoc
calls to Requests. We want a client-side API for our apps. Uplink is
the quickest and simplest way to build just that client-side API.
Highly recommended.Or Carmi(@liiight),notifiersmaintainer-Uplink’s intelligent usage of decorators and typing leverages the most
pythonic features in an elegant and dynamic way. If you need to create an
API abstraction layer, there is really no reason to look elsewhere.DocumentationCheck out the library’s documentation athttps://uplink.readthedocs.io/.For new users, a good place to start is thisquick tutorial.CommunityJoin the conversation onGitterto ask questions, provide feedback,
and meet other users!ContributingWant to report a bug, request a feature, or contribute code to Uplink?
Checkout theContribution Guidefor where to start.
Thank you for taking the time to improve an open source project :purple_heart: