From 376eacb616072ae152f2158b1621cd56d395f24a Mon Sep 17 00:00:00 2001 From: Josh Roesslein Date: Sun, 5 Jul 2009 22:50:04 -0500 Subject: [PATCH] Added account endpoints. Still need image update support. --- api.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ binder.py | 2 ++ parsers.py | 8 ++++++++ 3 files changed, 54 insertions(+) diff --git a/api.py b/api.py index e4ee61a..84e1256 100644 --- 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') diff --git a/binder.py b/binder.py index 8e3caeb..80bd8d3 100644 --- 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: diff --git a/parsers.py b/parsers.py index b20b206..3e58cfd 100644 --- a/parsers.py +++ b/parsers.py @@ -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) -- 2.25.1