Added show status endpoint.
authorJosh Roesslein <jroesslein@gmail.com>
Mon, 6 Jul 2009 00:57:53 +0000 (19:57 -0500)
committerJosh Roesslein <jroesslein@gmail.com>
Mon, 6 Jul 2009 00:57:53 +0000 (19:57 -0500)
api.py
binder.py
parsers.py

diff --git a/api.py b/api.py
index 9c48d0a6cdd19466d0c2b39c751e276c9547b1ec..55280e30b7368798eb996f23ca51ddbea81599f6 100644 (file)
--- a/api.py
+++ b/api.py
@@ -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')
index 5c704880db791ecb2c6569479ca8dd9f326970d9..8cd6380bac9255c259c81827c4fdba54541b4571 100644 (file)
--- a/binder.py
+++ b/binder.py
@@ -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:
index b8866fcabb5b5a61461a477a4b09839e34eca5cc..a412d26e9be35cd6e7e9bd3ce052f487cf414241 100644 (file)
@@ -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 = []