From: Joshua Roesslein Date: Mon, 21 Jan 2013 18:20:55 +0000 (-0800) Subject: More fixes for supporting v1.1 endpoints. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a5f75d89a820242e439d315b86a2c2d849505b9f;p=tweepy.git More fixes for supporting v1.1 endpoints. --- diff --git a/tweepy/api.py b/tweepy/api.py index c4f1f55..5b67d9b 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -314,8 +314,9 @@ class API(object): """ account/rate_limit_status """ rate_limit_status = bind_api( - path = '/account/rate_limit_status.json', + path = '/application/rate_limit_status.json', payload_type = 'json', + allowed_param = ['resources'], use_cache = False ) @@ -438,7 +439,7 @@ class API(object): """ saved_searches """ saved_searches = bind_api( - path = '/saved_searches.json', + path = '/saved_searches/list.json', payload_type = 'saved_search', payload_list = True, require_auth = True ) @@ -463,7 +464,7 @@ class API(object): """ saved_searches/destroy """ destroy_saved_search = bind_api( path = '/saved_searches/destroy/{id}.json', - method = 'DELETE', + method = 'POST', payload_type = 'saved_search', allowed_param = ['id'], require_auth = True @@ -503,37 +504,37 @@ class API(object): require_auth = True ) - lists = bind_api( - path = '/{user}/lists.json', + lists_all = bind_api( + path = '/lists/list.json', payload_type = 'list', payload_list = True, - allowed_param = ['user', 'cursor'], + allowed_param = ['screen_name', 'user_id'], require_auth = True ) lists_memberships = bind_api( - path = '/{user}/lists/memberships.json', + path = '/lists/memberships.json', payload_type = 'list', payload_list = True, - allowed_param = ['user', 'cursor'], + allowed_param = ['screen_name', 'user_id', 'filter_to_owned_lists', 'cursor'], require_auth = True ) lists_subscriptions = bind_api( - path = '/{user}/lists/subscriptions.json', + path = '/lists/subscriptions.json', payload_type = 'list', payload_list = True, - allowed_param = ['user', 'cursor'], + allowed_param = ['screen_name', 'user_id', 'cursor'], require_auth = True ) list_timeline = bind_api( - path = '/{owner}/lists/{slug}/statuses.json', + path = '/lists/statuses.json', payload_type = 'status', payload_list = True, - allowed_param = ['owner', 'slug', 'since_id', 'max_id', 'per_page', 'page'] + allowed_param = ['owner_screen_name', 'slug', 'owner_id', 'list_id', 'since_id', 'max_id', 'count'] ) get_list = bind_api( - path = '/{owner}/lists/{slug}.json', + path = '/lists/show.json', payload_type = 'list', - allowed_param = ['owner', 'slug'] + allowed_param = ['owner_screen_name', 'owner_id', 'slug', 'list_id'] ) add_list_member = bind_api( @@ -553,63 +554,61 @@ class API(object): ) list_members = bind_api( - path = '/{owner}/{slug}/members.json', + path = '/lists/members.json', payload_type = 'user', payload_list = True, - allowed_param = ['owner', 'slug', 'cursor'] + allowed_param = ['owner_screen_name', 'slug', 'list_id', 'owner_id', 'cursor'] ) - def is_list_member(self, owner, slug, user_id): - try: - return bind_api( - path = '/%s/%s/members/%s.json' % (owner, slug, user_id), - payload_type = 'user' - )(self) - except TweepError: - return False + show_list_member = bind_api( + path = '/lists/members/show.json', + payload_type = 'user', + allowed_param = ['list_id', 'slug', 'user_id', 'screen_name', 'owner_screen_name', 'owner_id'] + ) subscribe_list = bind_api( - path = '/{owner}/{slug}/subscribers.json', + path = '/lists/subscribers/create.json', method = 'POST', payload_type = 'list', - allowed_param = ['owner', 'slug'], + allowed_param = ['owner_screen_name', 'slug', 'owner_id', 'list_id'], require_auth = True ) unsubscribe_list = bind_api( - path = '/{owner}/{slug}/subscribers.json', - method = 'DELETE', + path = '/lists/subscribers/destroy.json', + method = 'POST', payload_type = 'list', - allowed_param = ['owner', 'slug'], + allowed_param = ['owner_screen_name', 'slug', 'owner_id', 'list_id'], require_auth = True ) list_subscribers = bind_api( - path = '/{owner}/{slug}/subscribers.json', + path = '/lists/subscribers.json', payload_type = 'user', payload_list = True, - allowed_param = ['owner', 'slug', 'cursor'] + allowed_param = ['owner_screen_name', 'slug', 'owner_id', 'list_id', 'cursor'] ) - def is_subscribed_list(self, owner, slug, user_id): - try: - return bind_api( - path = '/%s/%s/subscribers/%s.json' % (owner, slug, user_id), - payload_type = 'user' - )(self) - except TweepError: - return False + show_list_subscriber = bind_api( + path = '/lists/subscribers/show.json', + payload_type = 'user', + allowed_param = ['owner_screen_name', 'slug', 'screen_name', 'owner_id', 'list_id', 'user_id'] + ) """ trends/available """ trends_available = bind_api( path = '/trends/available.json', + payload_type = 'json' + ) + + trends_place = bind_api( + path = '/trends/place.json', payload_type = 'json', - allowed_param = ['lat', 'long'] + allowed_param = ['id', 'exclude'] ) - """ trends/location """ - trends_location = bind_api( - path = '/trends/{woeid}.json', + trends_closest = bind_api( + path = '/trends/closest.json', payload_type = 'json', - allowed_param = ['woeid'] + allowed_param = ['lat', 'long'] ) """ search """