This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

This is a client for classowl’s RESTful API based on slumber, a generic REST API client. Slumber turns an expression like:

>>> endpoint.users.me.get(param=2)

or:

>>> endpoint.users('me').get(param=2)

into an Http request like:

GET <endpoint>/users/me?param=2

or:

>>> endpoint.users('me').put(data)

into an Http request like:

PUT <endpoint>/users/me

It also serializes and deserlializes the data automatically to and from dictionaries.

Included are a factory for a slumber endpoint which provides authentication given a username and password or an access token:

>>> import classowl_client
>>> client = classowl_client.create('username', 'password')
>>> client.users.me.get()
DataObject(**{'email': 'you@host.com',
 'first_name': 'John',
 'id': 4387,
 'is_staff': False,
 'last_name': 'Smith',
 'profile': '/api/v1/user_profiles/4381/',
 'resource_uri': '/api/v1/users/4387/',
 'token': '2882386636-c50f9414ae284727fc9e'})

or, if you want to persist the token, avoiding repeating the initial login call:

>>> token = classowl_client.get_token('username', 'password')
>>> token
'78285b2c479c5f9f73ccca094b7f9307f2648144'
>>> client = classowl_client.create(token=token)
>>> client.users.me.get()
DataObject(**{'email': 'you@host.com',
 'first_name': 'John',
 'id': 4387,
 'is_staff': False,
 'last_name': 'Smith',
 'profile': '/api/v1/user_profiles/4381/',
 'resource_uri': '/api/v1/users/4387/',
 'token': '2882386636-c50f9414ae284727fc9e'})

A few lazily instantiated shortcuts to the main endpoints for convenience, which authenticate using the username and password set on the module:

>>> classowl_client.username = 'username'
>>> classowl_client.password = 'password'
>>> classowl_client.users.me.get()
DataObject(**{'email': 'you@host.com',
 'first_name': 'John',
 'id': 4387,
 'is_staff': False,
 'last_name': 'Smith',
 'profile': '/api/v1/user_profiles/4381/',
 'resource_uri': '/api/v1/users/4387/',
 'token': '2882386636-c50f9414ae284727fc9e'})

A serializer that turns the received data into objects:

>>> account = client.users.me.get()
>>> account
DataObject(**{'email': 'you@host.com',
 'first_name': 'John',
 'id': 4387,
 'is_staff': False,
 'last_name': 'Smith',
 'profile': '/api/v1/user_profiles/4381/',
 'resource_uri': '/api/v1/users/4387/',
 'token': '2882386636-c50f9414ae284727fc9e'})
>>> account.last_name
'Smith'

Its main feature is turning the uri fields into usable endpoints:

>>> account.profile.get()
DataObject(**{'avatar_url': None,
 'current_year': None,
 'department': None,
 'email_notifications': True,
 'graduation_year': 2013,
 'id': 4381,
 'is_private': False,
 'is_valid_email': True,
 'resource_uri': '/api/v1/user_profiles/4381/',
 'role': 3,
 'school': '/api/v1/schools/5/',
 'unread_notifications': 40,
 'user': '/api/v1/users/4387/',
 'walkthrough_step': 5})

To update the information:

>>> account.last_name = 'Brown'
>>> classowl_client.users.me.put(account)
DataObject(**{'email': 'you@host.com',
 'first_name': 'John',
 'id': 4387,
 'is_staff': False,
 'last_name': 'Brown',
 'pk': 4387,
 'profile': '/api/v1/user_profiles/4381/',
 'resource_uri': '/api/v1/users/4387/',
 'token': '2882386636-c50f9414ae284727fc9e'})
>>> classowl_client.users.me.get()
DataObject(**{'email': 'you@host.com',
 'first_name': 'John',
 'id': 4387,
 'is_staff': False,
 'last_name': 'Brown',
 'profile': '/api/v1/user_profiles/4381/',
 'resource_uri': '/api/v1/users/4387/',
 'token': '2882386636-c50f9414ae284727fc9e'})

You can get the plain dictionary data from it like so:

>>> dict(account)
{'email': 'you@host.com',
 'first_name': 'John',
 'id': 4387,
 'is_staff': False,
 'last_name': 'Smith',
 'profile': '/api/v1/user_profiles/4381/',
 'resource_uri': '/api/v1/users/4387/',
 'token': '2882386636-c50f9414ae284727fc9e'}
Release History

Release History

0.1a2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1a1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
classowl-client-0.1a2.tar.gz (4.2 kB) Copy SHA256 Checksum SHA256 Source Jun 20, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting