Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can someone suggest a well-designed Python wrapper of a REST API? [closed]

Tags:

python

rest

api

I'm writing a new one (for Netflix), and am simply wondering if there are any great reference libraries for me to study.

In particular I'm looking for clever ways to express a single REST endpoint in code, which needs a least a URL, method, and params, and in the case of Netflix, information about the authentication level required.

To be clear, I am looking for idiomatic and well-written Python libraries covering REST APIs. If the library is blazing fast, but is difficult to use and/or poorly written, I'm probably less interested.

like image 988
Kenan Banks Avatar asked Aug 17 '09 14:08

Kenan Banks


1 Answers

This is a really old question, but since I came to it still, I thought I'd provide a quick answer.

I've used the GitHub3 wrapper a fair bit and I've always been really impressed by the documentation. One issue with using it as a guide is that it's absolutely huge.

Another nice wrapper is the Gdax-python wrapper for accessing the Gdax exchange for cryptocurrencies. Though it's seriously lacking in-code documentation and I'm not a fan of having separate clients for public API calls and authenticated API calls, I've always found it remarkably easy to use.

I'm sure there are a ton of other ones, but many of the ones I've used fall into some major traps. A couple personal recommendations:

  • have a single client class that manages all communications

  • set up a client requests.Session() object to set up all auth/header information for all calls

  • use a single _make_requests class function that assembles the url, sends the request, and handles all the various HTTP status codes that can be returned.

like image 139
Michael Bianchi Avatar answered Oct 11 '22 15:10

Michael Bianchi