Added update and destroy status endpoints.
authorJosh Roesslein <jroesslein@gmail.com>
Mon, 6 Jul 2009 01:36:17 +0000 (20:36 -0500)
committerJosh Roesslein <jroesslein@gmail.com>
Mon, 6 Jul 2009 01:36:17 +0000 (20:36 -0500)
api.py
binder.py

diff --git a/api.py b/api.py
index 55280e30b7368798eb996f23ca51ddbea81599f6..55dacb7fad617801746c8e9752d74233c44e34a8 100644 (file)
--- a/api.py
+++ b/api.py
@@ -55,4 +55,22 @@ class API(object):
       allowed_param = ['id']
   )
 
+  """Update status"""
+  update_status = bind_api(
+      path = '/statuses/update.json',
+      method = 'POST',
+      parser = parse_status,
+      allowed_param = ['status', 'in_reply_to_status_id'],
+      require_auth = True
+  )
+
+  """Destroy status"""
+  destroy_status = bind_api(
+      path = '/statuses/destroy.json',
+      method = 'DELETE',
+      parser = parse_status,
+      allowed_param = ['id'],
+      require_auth = True
+  )
+
 api = API('jitterapp', 'josh1987')
index 8cd6380bac9255c259c81827c4fdba54541b4571..143a13e98c9e926adeb620738b1b777fbf1572a2 100644 (file)
--- a/binder.py
+++ b/binder.py
@@ -45,6 +45,10 @@ def bind_api(path, parser, allowed_param=None, method='GET', require_auth=False)
       raise TweepError(parse_error(resp.read()))
 
     # Pass returned body into parser and return parser output
-    return parser(resp.read(), api.classes)
+    out =  parser(resp.read(), api.classes)
+
+    # close connection and return data
+    conn.close()
+    return out
 
   return _call