Commit 543ac3b6 authored by Josh Roesslein's avatar Josh Roesslein
Browse files

Added show status endpoint.

parent 5f31944d
......@@ -48,4 +48,11 @@ class API(object):
require_auth = True
)
"""Show status"""
get_status = bind_api(
path = '/statuses/show.json',
parser = parse_status,
allowed_param = ['id']
)
api = API('jitterapp', 'josh1987')
......@@ -6,18 +6,14 @@ from error import TweepError
def bind_api(path, parser, allowed_param=None, method='GET', require_auth=False):
def _call(api, **kargs):
def _call(api, *args, **kargs):
# If require auth, throw exception if credentials not provided
if require_auth and not api._b64up:
raise TweepError('Authentication required!')
# Filter out unallowed parameters
if len(kargs) == 0:
parameters = None
elif allowed_param:
if allowed_param:
parameters = dict((k,v) for k,v in kargs.items() if k in allowed_param)
else:
parameters = kargs
# Open connection
if api.secure:
......
......@@ -39,6 +39,10 @@ def _parse_status(obj, classes):
setattr(status, k, v)
return status
def parse_status(data, classes):
return _parse_status(json.loads(data), classes)
def parse_statuses(data, classes):
statuses = []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment