Skip to content

straup/py-flamework-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

py-flamework-api

Base class for flamework-api derived API classes

Example

Simple

from flamework.api.client import OAuth2

HOSTNAME='api.collection.cooperhewitt.org'
ENDPOINT='/rest'

TOKEN='S33KR3T'

api = OAuth2(ACCESS_TOKEN, hostname=HOSTNAME, endpoint=ENDPOINT)

method = 'cooperhewitt.labs.whatWouldMicahSay'
args = {}

rsp = api.execute_method(method, args)
print rsp

Subclassing

import flamework.api.client

class oauth2_client(flamework.api.client.OAuth2):

	def __init__(self, token, **kwargs):

		kwargs['hostname'] = 'example.com'
		kwargs['endpoint'] = '/rest'

		flamework.api.client.OAuth2.__init__(self, token, **kwargs)

That's it.

See also

About

Base class for flamework-api derived API classes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%