require_auth = True
)
+ """Show status"""
+ get_status = bind_api(
+ path = '/statuses/show.json',
+ parser = parse_status,
+ allowed_param = ['id']
+ )
+
api = API('jitterapp', 'josh1987')
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:
setattr(status, k, v)
return status
+def parse_status(data, classes):
+
+ return _parse_status(json.loads(data), classes)
+
def parse_statuses(data, classes):
statuses = []