Skip to content
Python Client for Flair API
Python Dockerfile
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
flair_api Make timeout configurable with an argument to the client constructor Mar 25, 2019
.travis.yml Update to work on python 2.7 Sep 9, 2016 Update contribution guidelines and LICENSE Apr 8, 2016
Dockerfile Update dependencies Mar 15, 2019
LICENSE.txt Prepare for release Nov 1, 2016 Fix syntax error in README Apr 8, 2016
requirements.txt Update dependencies Mar 15, 2019
setup.cfg Prepare for release Nov 1, 2016 Add resource colleciton class to handle paging Nov 18, 2016

Flair API Client (Python) Build Status

This package provides a very simple API client for the Flair API. Since the Flair API uses the JSON-API standard, this client is just a very thin wrapper around a JSON API client, but provides hooks for a extending it with custom models.


Eventually this will be released on PyPi, for now you'll need to install via github

pip install git+git://

This package depdends on requests, and requires Python 3.5 or greater.


from flair_api import make_client

client = make_client(client_id, client_secret, '')

# retrieve a list of structures available to this account
structures = client.get('structures')

# get a single room by id
room = client.get('rooms', id="1")

# fetch vents in a room
vents = room.get_rel('vents')

# delete a room

# update a room
room.update(attributes={'name': 'Master Bedroom'}, relationships=dict(structure=structures[0], vents=vents))

# create a vent
vent = c.create('vents', attributes={'name': 'North Vent'}, relationships=dict(room=room))

# Add a vent to a room

# Update vent relationship for a room

# Delete a vent relationship for a room


At the moment, this package only supports authenticating to the Flair API using a client credentials request. This will give access to resources owned by the user to whom the credentials were issued. Support for other OAuth flow will be coming in future releases.


If, instead of having requests initialize or update the default Resource object, you'd like to use your own classes you can initialize the client with a mapper:

from flair_api import make_client, Resource

class User(Resource):
    def __init__(*args, **kwargs):
        self.__super__.init(*args, **kwargs)
    def __str__(self):
        return "User: " + self.attributes['name']
client = make_client(client_id, client_secret, '', mapper={'users': User})

users = client.get('users')

for user in users:
    print(user)  # "User: Edward", "User: Kenny", "User: Danimal"


Contributions are welcome by anyone. To get started, sign the Contributor License Agreement.


Copyright 2016 by Standard Euler, Inc

Licensed under the Apache Public License 2.0. See LICENSE.

You can’t perform that action at this time.