Ejemplo n.º 1
0
import helpers
import contextio as c

CONSUMER_KEY = "YOUR_CONTEXTIO_CONSUMER_KEY"
CONSUMER_SECRET = "YOUR_CONTEXTIO_CONSUMER_KEY"
EXISTING_USER_ID = "AN_EXISTING_LITE_API_USER_ID"  # see the ContextIO dev console

api = c.ContextIO(consumer_key=CONSUMER_KEY,
                  consumer_secret=CONSUMER_SECRET,
                  api_version="lite",
                  debug=True)

user = c.User(api, {"id": EXISTING_USER_ID})

helpers.headerprint("FETCHING USER INFO (Lite API)")

user.get()

helpers.cprint("id", user.id)
helpers.cprint("email_accounts", user.email_accounts)
helpers.cprint("email_addresses", user.email_addresses)
helpers.cprint("created", user.created)
helpers.cprint("first_name", user.first_name)
helpers.cprint("last_name", user.last_name)
helpers.cprint("resource_url", user.resource_url)
print "\n"
Ejemplo n.º 2
0
import helpers
import contextio as c

CONSUMER_KEY = "YOUR_CONTEXTIO_CONSUMER_KEY"
CONSUMER_SECRET = "YOUR_CONTEXTIO_CONSUMER_KEY"
EXISTING_USER_ID = "AN_EXISTING_LITE_API_USER_ID" # see the ContextIO dev console

api = c.ContextIO(
    consumer_key=CONSUMER_KEY,
    consumer_secret=CONSUMER_SECRET,
    api_version="lite",
    debug=True
)

user = c.User(api, {"id": EXISTING_USER_ID})

helpers.headerprint("FETCHING USER INFO (Lite API)")

user.get()

helpers.cprint("id", user.id)
helpers.cprint("email_accounts", user.email_accounts)
helpers.cprint("email_addresses", user.email_addresses)
helpers.cprint("created", user.created)
helpers.cprint("first_name", user.first_name)
helpers.cprint("last_name", user.last_name)
helpers.cprint("resource_url", user.resource_url)
print "\n"

import helpers
import contextio as c

CONSUMER_KEY = "YOUR_CONTEXTIO_CONSUMER_KEY"
CONSUMER_SECRET = "YOUR_CONTEXTIO_CONSUMER_KEY"

api = c.ContextIO(
    consumer_key=CONSUMER_KEY,
    consumer_secret=CONSUMER_SECRET,
    debug=True
) # returns v2.0 API by default

helpers.headerprint("FETCHING ACCOUNTS (v2.0 API)")

accounts = api.get_accounts()

print accounts
print "\n"
print "Found {0} accounts.".format(len(accounts))
print "\n"
import helpers
import contextio as c

CONSUMER_KEY = "YOUR_CONTEXTIO_CONSUMER_KEY"
CONSUMER_SECRET = "YOUR_CONTEXTIO_CONSUMER_KEY"
EXISTING_ACCOUNT_ID = "AN_EXISTING_2.0_API_ACCOUNT_ID" # see the ContextIO dev console

api = c.ContextIO(consumer_key=CONSUMER_KEY, consumer_secret=CONSUMER_SECRET, debug=True)

account = c.Account(api, {"id": EXISTING_ACCOUNT_ID})

helpers.headerprint("FETCHING ACCOUNT INFO (Lite API)")

account.get()

helpers.cprint("id", account.id)
helpers.cprint("username", account.username)
helpers.cprint("created", account.created)
helpers.cprint("suspended", account.suspended)
helpers.cprint("email_addresses", account.email_addresses)
helpers.cprint("first_name", account.first_name)
helpers.cprint("last_name", account.last_name)
helpers.cprint("password_expired", account.password_expired)
helpers.cprint("sources", account.sources)
helpers.cprint("resource_url", account.resource_url)
print "\n"

import helpers
import contextio as c

CONSUMER_KEY = "YOUR_CONTEXTIO_CONSUMER_KEY"
CONSUMER_SECRET = "YOUR_CONTEXTIO_CONSUMER_KEY"

api = c.ContextIO(consumer_key=CONSUMER_KEY,
                  consumer_secret=CONSUMER_SECRET,
                  debug=True)  # returns v2.0 API by default

helpers.headerprint("FETCHING ACCOUNTS (v2.0 API)")

accounts = api.get_accounts()

print accounts
print "\n"
print "Found {0} accounts.".format(len(accounts))
print "\n"