From: Josh Roesslein Date: Mon, 6 Jul 2009 03:50:04 +0000 (-0500) Subject: Added account endpoints. Still need image update support. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=376eacb616072ae152f2158b1621cd56d395f24a;p=tweepy.git Added account endpoints. Still need image update support. --- 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)