Not Logged In

syndicate 0.99.5

Abstraction for HTTP based REST APIs. This provides a means to genericallyhandle serialization (JSON) and URI mapping as seen in many of the REST APIspublished these days. Currently Tastypie APIs are the primary target but thesystem should be compossible enough to work with other APIs if they workroughly the same way.

Requirements========

* Requests (sync mode)* Tornado (async mode)

Installation========

python ./setup.py build python ./setup.py install

Compatibility========

* Python 2.7* Python 3.3+

TODO========

* Unified authentication between HTTP adapters.* Documentation

Getting Started========

Syndicate has two basic modes for communicating with an API, sync and async.The sync mode uses the 'requests' library as the HTTP adapter and the asyncmode uses the 'tornado' web framework. An adapter can be provided by theuser if they have their own backend to use too; Twisted for example.

In either mode, your interface is a 'Service' instance, which facilitatesauthentication, session management (via an adapter) and serialization.

Synchronous Examples========

**Creating a connnection**

Instantiate a service class with some basic descriptions of the remote APIto get a persistent connection.

Keyword arguments are converted to URL queries. To filter by an exactfield match such as https://a.bakery.fake/api/v1/cake/?type=cheese wesimply add the 'type' keyword to the <verb>() call. This example deletesall cheese cakes because I hate cheese.

```pythonfor x in bakery.get('cake', type='cheese'): x.delete()```

**Update a resource**

Resources implement the mapping protocol so they work like dictionaries.

If your service has non CRUD methods, you can ask a service to "do" thingsdirectly. Let's "BAKE /api/v1/cake/100" with some instructions in the contentbody.

```pythonbakery.do('bake', 'cake', 100, temp=420, time=3600)```

Asynchronous Examples========

Async service connections use Tornado, http://www.tornadoweb.org/If this is your first time doing async programming or using tornado, youshould get familiar with it first.

Tornado Docs: http://www.tornadoweb.org/en/stable/documentation.html

The examples below assume you are running your code from a IOLoop callbackin the same thread as the IOLoop runner. Most of the calls made to anasync service return concurrent.Future objects so you can use all thefun patterns available to Tornado applications.

**Creating a service connnection with Basic auth**```pythonimport syndicate