Skip to main content

I did not create this package; I'm just adding it to pypi. It's already freely available on GitHub.

Project description

Context.IO API v2.0 Python Library

This is the python client library for v2.0 of the Context.IO API!

RAUTH - If you do not have that, snag it with
```$ pip install rauth```
```$ easy_install rauth```
, or “Use the [Source](, Luke”

REQUESTS - rauth is built on top of the requests module
```$ pip install requests```
```$ easy_install requests```
or [Source](

Check out / download the module from git, change directory to the folder with and run:

python install

You'll probably want to toss a sudo before that, depending on your OS. That's it though!

You first need to instantiate the main ContextIO object with your API credentials:

import contextio as c


context_io = c.ContextIO(

The ContextIO class can optionally accept a debug keyword parameter that prints or logs more info about the request and response.

The module is fully docstringed out, so feel free to jump into the python interpreter and help(foo) on stuff. Explore the resource classes and methods!

Here's how you can query the API for an account:

accounts = context_io.get_accounts(email='')
# since we return a list, let's be sure we have a result
if accounts:
account = accounts[0]

The Account class has methods to represent all the kinds of requests you can make under that resource.

If you store account ids, message ids, file ids, or anything else like that on your server, you can instantiate these objects without touching the API, for increased speed. Here's an example of how you do that.

params = {
account = c.Account(context_io, params)

That'll just be an empty object, but you need to pass in the "id" since that's used to form the URL for API endpoints for the account resource. If you want to query the API and populate that account object, you can simply do a:


You can use this same technique to populate sub-resource objects too.

params = {
'message_id': 'MESSAGE_ID_HERE'
message = c.Message(account, params)
# populate the message object with data from the API

Notice how the Message class needs an Account object as a parent? That's because the library uses an object's ancestors to build the URL.

If you have any questions, don't hesitate to contact (that's me!). I'd love to assist you with any issues you encounter and learn how you'll use Context.IO!

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for context-io-2, version 2.0.1
Filename, size File type Python version Upload date Hashes
Filename, size context-io-2-2.0.1.tar.gz (23.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page