Added account endpoints. Still need image update support.
authorJosh Roesslein <jroesslein@gmail.com>
Mon, 6 Jul 2009 03:50:04 +0000 (22:50 -0500)
committerJosh Roesslein <jroesslein@gmail.com>
Mon, 6 Jul 2009 03:50:04 +0000 (22:50 -0500)
api.py
binder.py
parsers.py

diff --git a/api.py b/api.py
index e4ee61a57e033c2202f4d26602eecc55f802f2cc..84e12567618e3c7c68d6b2604d3f58b7e85238d3 100644 (file)
--- a/api.py
+++ b/api.py
@@ -185,4 +185,48 @@ class API(object):
       allowed_param = ['id', 'user_id', 'screen_name', 'page']
   )
 
+  """Verify credentials"""
+  verify_credentials = bind_api(
+      path = '/account/verify_credentials.json',
+      parser = parse_verify_credentials,
+      require_auth = True
+  )
+
+  """Rate limit status"""
+  rate_limit_status = bind_api(
+      path = '/account/rate_limit_status.json',
+      parser = parse_rate_limit
+  )
+
+  """Update delivery device"""
+  set_delivery_device = bind_api(
+      path = '/account/update_delivery_device.json',
+      method = 'POST',
+      allowed_param = ['device'],
+      parser = parse_user,
+      require_auth = True
+  )
+
+  """Update profile colors"""
+  update_profile_colors = bind_api(
+      path = '/account/update_profile_colors.json',
+      method = 'POST',
+      parser = parse_user,
+      allowed_param = ['profile_background_color', 'profile_text_color',
+                        'profile_link_color', 'profile_sidebar_fill_color',
+                        'profile_sidebar_border_color'],
+      require_auth = True
+  )
+
+  # todo: add support for changing profile and background images
+
+  """Update profile"""
+  update_profile = bind_api(
+      path = '/account/update_profile.json',
+      method = 'POST',
+      parser = parse_user,
+      allowed_param = ['name', 'email', 'url', 'location', 'description'],
+      require_auth = True
+  )
+
 api = API('jitterapp', 'josh1987')
index 8e3caeb2ca7b5f44396541058a0a3fc59c911be2..80bd8d3aa0ad8ca3ead536ab4f4ed4359bf301a6 100644 (file)
--- a/binder.py
+++ b/binder.py
@@ -14,6 +14,8 @@ def bind_api(path, parser, allowed_param=None, method='GET', require_auth=False)
     # Filter out unallowed parameters
     if allowed_param:
       parameters = dict((k,v) for k,v in kargs.items() if k in allowed_param)
+    else:
+      parameters = None
 
     # Open connection
     if api.secure:
index b20b206af5bc57599231325de9416ff8839f5e99..3e58cfdb28b7ed3ab18782d00b854cb49f4da0cd 100644 (file)
@@ -108,3 +108,11 @@ def parse_bool(data, api):
 def parse_ids(data, api):
 
   return json.loads(data)
+
+def parse_verify_credentials(data, api):
+
+  return True
+
+def parse_rate_limit(data, api):
+
+  return json.loads(data)