Change api to positional argument for bind_api
authorHarmon <Harmon758@gmail.com>
Wed, 3 Feb 2021 07:28:20 +0000 (01:28 -0600)
committerHarmon <Harmon758@gmail.com>
Wed, 3 Feb 2021 07:28:20 +0000 (01:28 -0600)
tweepy/api.py
tweepy/binder.py

index 616399d0b8f35e48d132ceb7be981c64a7b556a0..29e7f5f09698dad55fea4b0fc141288b3f491972 100644 (file)
@@ -78,7 +78,7 @@ class API:
                             'exclude_replies', 'include_entities'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/statuses/home_timeline.json',
             allowed_param=['count', 'since_id', 'max_id', 'trim_user',
                            'exclude_replies', 'include_entities'],
@@ -95,7 +95,7 @@ class API:
             kwargs['map'] = kwargs.pop('map_')
 
         return bind_api(
-            list_to_csv(id_), *args, api=self,
+            self, list_to_csv(id_), *args,
             path='/statuses/lookup.json',
             allowed_param=['id', 'include_entities', 'trim_user', 'map',
                            'include_ext_alt_text', 'include_card_uri'],
@@ -111,7 +111,7 @@ class API:
                             'include_rts'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/statuses/user_timeline.json',
             allowed_param=['user_id', 'screen_name', 'since_id', 'count',
                            'max_id', 'trim_user', 'exclude_replies',
@@ -125,7 +125,7 @@ class API:
             :allowed_param: 'since_id', 'max_id', 'count'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/statuses/mentions_timeline.json',
             allowed_param=['since_id', 'max_id', 'count'],
             require_auth=True, **kwargs
@@ -138,7 +138,7 @@ class API:
             :allowed_param: 'since_id', 'max_id', 'count'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/statuses/retweets_of_me.json',
             allowed_param=['since_id', 'max_id', 'count'],
             require_auth=True, **kwargs
@@ -152,7 +152,7 @@ class API:
                             'include_card_uri'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/statuses/show.json',
             allowed_param=['id', 'trim_user', 'include_my_retweet',
                            'include_entities', 'include_ext_alt_text',
@@ -173,7 +173,7 @@ class API:
             kwargs['media_ids'] = list_to_csv(kwargs['media_ids'])
 
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/statuses/update.json',
             method='POST',
             allowed_param=['status', 'in_reply_to_status_id',
@@ -210,7 +210,7 @@ class API:
         kwargs.update({'headers': headers, 'post_data': post_data})
 
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/media/upload.json',
             method='POST',
             allowed_param=[],
@@ -228,7 +228,7 @@ class API:
         }
 
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/media/metadata/create.json',
             method='POST',
             allowed_param=[],
@@ -251,7 +251,7 @@ class API:
         kwargs.update({'headers': headers, 'post_data': post_data})
 
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/statuses/update_with_media.json',
             method='POST',
             allowed_param=['status', 'possibly_sensitive',
@@ -268,7 +268,7 @@ class API:
             :allowed_param:
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path=f'/statuses/destroy/{status_id}.json',
             method='POST',
             require_auth=True, **kwargs
@@ -280,7 +280,7 @@ class API:
             :allowed_param:
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path=f'/statuses/retweet/{status_id}.json',
             method='POST',
             require_auth=True, **kwargs
@@ -292,7 +292,7 @@ class API:
             :allowed_param:
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path=f'/statuses/unretweet/{status_id}.json',
             method='POST',
             require_auth=True, **kwargs
@@ -304,7 +304,7 @@ class API:
             :allowed_param: 'count'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path=f'/statuses/retweets/{status_id}.json',
             allowed_param=['count'],
             require_auth=True, **kwargs
@@ -317,7 +317,7 @@ class API:
             :allowed_param: 'id', 'cursor', 'stringify_ids
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/statuses/retweeters/ids.json',
             allowed_param=['id', 'cursor', 'stringify_ids'], **kwargs
         )
@@ -328,7 +328,7 @@ class API:
             :allowed_param: 'id', 'user_id', 'screen_name'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/users/show.json',
             allowed_param=['id', 'user_id', 'screen_name'], **kwargs
         )
@@ -341,7 +341,7 @@ class API:
                             'link_color', 'widget_type', 'dnt'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/statuses/oembed.json',
             allowed_param=['url', 'maxwidth', 'hide_media', 'hide_thread',
                            'omit_script', 'align', 'related', 'lang', 'theme',
@@ -355,7 +355,7 @@ class API:
                             'tweet_mode'
         """
         return bind_api(
-            list_to_csv(user_ids), list_to_csv(screen_names), *args, api=self,
+            self, list_to_csv(user_ids), list_to_csv(screen_names), *args,
             path='/users/lookup.json',
             method='POST',
             allowed_param=['user_id', 'screen_name', 'include_entities',
@@ -373,7 +373,7 @@ class API:
             :allowed_param: 'q', 'count', 'page'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/users/search.json',
             require_auth=True,
             allowed_param=['q', 'count', 'page'], **kwargs
@@ -385,7 +385,7 @@ class API:
             :allowed_param: 'id'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/direct_messages/events/show.json',
             allowed_param=['id'],
             require_auth=True, **kwargs
@@ -398,7 +398,7 @@ class API:
             :allowed_param: 'count', 'cursor'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/direct_messages/events/list.json',
             allowed_param=['count', 'cursor'],
             require_auth=True, **kwargs
@@ -434,7 +434,7 @@ class API:
         if ctas is not None:
             message_data['ctas'] = ctas
         return bind_api(
-            api=self,
+            self,
             path='/direct_messages/events/new.json',
             method='POST',
             require_auth=True, 
@@ -446,7 +446,7 @@ class API:
             :allowed_param: 'id'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/direct_messages/events/destroy.json',
             method='DELETE',
             allowed_param=['id'],
@@ -459,7 +459,7 @@ class API:
             :allowed_param: 'id', 'user_id', 'screen_name', 'follow'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/friendships/create.json',
             method='POST',
             allowed_param=['id', 'user_id', 'screen_name', 'follow'],
@@ -472,7 +472,7 @@ class API:
             :allowed_param: 'id', 'user_id', 'screen_name'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/friendships/destroy.json',
             method='POST',
             allowed_param=['id', 'user_id', 'screen_name'],
@@ -486,7 +486,7 @@ class API:
                             'target_screen_name'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/friendships/show.json',
             allowed_param=['source_id', 'source_screen_name',
                            'target_id', 'target_screen_name'], **kwargs
@@ -498,7 +498,7 @@ class API:
             :allowed_param: 'user_id', 'screen_name'
         """
         return bind_api(
-            list_to_csv(user_ids), list_to_csv(screen_names), api=self,
+            self, list_to_csv(user_ids), list_to_csv(screen_names),
             path='/friendships/lookup.json',
             allowed_param=['user_id', 'screen_name'],
             require_auth=True, **kwargs
@@ -511,7 +511,7 @@ class API:
             :allowed_param: 'id', 'user_id', 'screen_name', 'cursor'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/friends/ids.json',
             allowed_param=['id', 'user_id', 'screen_name', 'cursor'], **kwargs
         )
@@ -524,7 +524,7 @@ class API:
                             'skip_status', 'include_user_entities'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/friends/list.json',
             allowed_param=['id', 'user_id', 'screen_name', 'cursor', 'count',
                            'skip_status', 'include_user_entities'], **kwargs
@@ -537,7 +537,7 @@ class API:
             :allowed_param: 'cursor'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/friendships/incoming.json',
             allowed_param=['cursor'], **kwargs
         )
@@ -549,7 +549,7 @@ class API:
             :allowed_param: 'cursor'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/friendships/outgoing.json',
             allowed_param=['cursor'], **kwargs
         )
@@ -561,7 +561,7 @@ class API:
             :allowed_param: 'id', 'user_id', 'screen_name', 'cursor', 'count'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/followers/ids.json',
             allowed_param=['id', 'user_id', 'screen_name', 'cursor', 'count'],
             **kwargs
@@ -575,7 +575,7 @@ class API:
                             'skip_status', 'include_user_entities'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/followers/list.json',
             allowed_param=['id', 'user_id', 'screen_name', 'cursor', 'count',
                            'skip_status', 'include_user_entities'], **kwargs
@@ -585,7 +585,7 @@ class API:
     def get_settings(self, *args, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-settings """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/account/settings.json',
             use_cache=False, **kwargs
         )
@@ -599,7 +599,7 @@ class API:
                             'allow_contributor_request', 'lang'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/account/settings.json',
             method='POST',
             allowed_param=['sleep_time_enabled', 'start_sleep_time',
@@ -618,7 +618,7 @@ class API:
             kwargs['include_email'] = str(kwargs['include_email']).lower()
         try:
             return bind_api(
-                api=self,
+                self,
                 path='/account/verify_credentials.json',
                 require_auth=True,
                 allowed_param=['include_entities', 'skip_status',
@@ -635,7 +635,7 @@ class API:
             :allowed_param: 'resources'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/application/rate_limit_status.json',
             allowed_param=['resources'],
             use_cache=False, **kwargs
@@ -648,7 +648,7 @@ class API:
         """
         headers, post_data = API._pack_image(filename, 700, f=file_)
         return bind_api(
-            api=self,
+            self,
             path='/account/update_profile_image.json',
             method='POST',
             allowed_param=['include_entities', 'skip_status'],
@@ -664,7 +664,7 @@ class API:
         headers, post_data = API._pack_image(filename, 700,
                                              form_field='banner', f=f)
         return bind_api(
-            api=self,
+            self,
             path='/account/update_profile_banner.json',
             method='POST',
             allowed_param=['width', 'height', 'offset_left', 'offset_right'],
@@ -679,7 +679,7 @@ class API:
                             'profile_link_color'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/account/update_profile.json',
             method='POST',
             allowed_param=['name', 'url', 'location', 'description',
@@ -695,7 +695,7 @@ class API:
                             'since_id'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/favorites/list.json',
             allowed_param=['screen_name', 'user_id', 'max_id', 'count',
                            'since_id'], **kwargs
@@ -707,7 +707,7 @@ class API:
             :allowed_param: 'id'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/favorites/create.json',
             method='POST',
             allowed_param=['id'],
@@ -720,7 +720,7 @@ class API:
             :allowed_param: 'id'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/favorites/destroy.json',
             method='POST',
             allowed_param=['id'],
@@ -733,7 +733,7 @@ class API:
             :allowed_param: 'id', 'user_id', 'screen_name'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/blocks/create.json',
             method='POST',
             allowed_param=['id', 'user_id', 'screen_name'],
@@ -746,7 +746,7 @@ class API:
             :allowed_param: 'id', 'user_id', 'screen_name'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/blocks/destroy.json',
             method='POST',
             allowed_param=['id', 'user_id', 'screen_name'],
@@ -760,7 +760,7 @@ class API:
             :allowed_param: 'cursor'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/mutes/users/ids.json',
             allowed_param=['cursor'],
             require_auth=True, **kwargs
@@ -773,7 +773,7 @@ class API:
             :allowed_param: 'cursor', 'include_entities', 'skip_status'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/mutes/users/list.json',
             allowed_param=['cursor', 'include_entities', 'skip_status'],
             required_auth=True, **kwargs
@@ -785,7 +785,7 @@ class API:
             :allowed_param: 'id', 'user_id', 'screen_name'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/mutes/users/create.json',
             method='POST',
             allowed_param=['id', 'user_id', 'screen_name'],
@@ -798,7 +798,7 @@ class API:
             :allowed_param: 'id', 'user_id', 'screen_name'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/mutes/users/destroy.json',
             method='POST',
             allowed_param=['id', 'user_id', 'screen_name'],
@@ -812,7 +812,7 @@ class API:
             :allowed_param: 'cursor'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/blocks/list.json',
             allowed_param=['cursor'],
             require_auth=True, **kwargs
@@ -825,7 +825,7 @@ class API:
             :allowed_param: 'cursor'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/blocks/ids.json',
             allowed_param=['cursor'],
             require_auth=True, **kwargs
@@ -837,7 +837,7 @@ class API:
             :allowed_param: 'user_id', 'screen_name', 'perform_block'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/users/report_spam.json',
             method='POST',
             allowed_param=['user_id', 'screen_name', 'perform_block'],
@@ -848,7 +848,7 @@ class API:
     def saved_searches(self, *args, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-saved_searches-list """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/saved_searches/list.json',
             require_auth=True, **kwargs
         )
@@ -859,7 +859,7 @@ class API:
             :allowed_param:
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path=f'/saved_searches/show/{saved_search_id}.json',
             require_auth=True, **kwargs
         )
@@ -870,7 +870,7 @@ class API:
             :allowed_param: 'query'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/saved_searches/create.json',
             method='POST',
             allowed_param=['query'],
@@ -883,7 +883,7 @@ class API:
             :allowed_param:
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path=f'/saved_searches/destroy/{saved_search_id}.json',
             method='POST',
             require_auth=True, **kwargs
@@ -895,7 +895,7 @@ class API:
             :allowed_param: 'name', 'mode', 'description'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/lists/create.json',
             method='POST',
             allowed_param=['name', 'mode', 'description'],
@@ -908,7 +908,7 @@ class API:
             :allowed_param: 'owner_screen_name', 'owner_id', 'list_id', 'slug'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/lists/destroy.json',
             method='POST',
             allowed_param=['owner_screen_name', 'owner_id', 'list_id', 'slug'],
@@ -922,7 +922,7 @@ class API:
                             'owner_screen_name', 'owner_id'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/lists/update.json',
             method='POST',
             allowed_param=['list_id', 'slug', 'name', 'mode', 'description',
@@ -936,7 +936,7 @@ class API:
             :allowed_param: 'screen_name', 'user_id', 'reverse'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/lists/list.json',
             allowed_param=['screen_name', 'user_id', 'reverse'],
             require_auth=True, **kwargs
@@ -950,7 +950,7 @@ class API:
                             'cursor', 'count'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/lists/memberships.json',
             allowed_param=['screen_name', 'user_id', 'filter_to_owned_lists',
                            'cursor', 'count'],
@@ -964,7 +964,7 @@ class API:
             :allowed_param: 'user_id', 'screen_name', 'count', 'cursor'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/lists/ownerships.json',
             allowed_param=['user_id', 'screen_name', 'count', 'cursor'],
             require_auth=True, **kwargs
@@ -977,7 +977,7 @@ class API:
             :allowed_param: 'screen_name', 'user_id', 'cursor', 'count'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/lists/subscriptions.json',
             allowed_param=['screen_name', 'user_id', 'cursor', 'count'],
             require_auth=True, **kwargs
@@ -992,7 +992,7 @@ class API:
                             'include_rts'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/lists/statuses.json',
             allowed_param=['owner_screen_name', 'slug', 'owner_id', 'list_id',
                            'since_id', 'max_id', 'count', 'include_entities',
@@ -1005,7 +1005,7 @@ class API:
             :allowed_param: 'owner_screen_name', 'owner_id', 'slug', 'list_id'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/lists/show.json',
             allowed_param=['owner_screen_name', 'owner_id', 'slug', 'list_id'],
             **kwargs
@@ -1018,7 +1018,7 @@ class API:
                             'owner_id', 'slug', 'list_id'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/lists/members/create.json',
             method='POST',
             allowed_param=['screen_name', 'user_id', 'owner_screen_name',
@@ -1033,7 +1033,7 @@ class API:
                             'owner_id', 'slug', 'list_id'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/lists/members/destroy.json',
             method='POST',
             allowed_param=['screen_name', 'user_id', 'owner_screen_name',
@@ -1050,9 +1050,8 @@ class API:
                             'owner_id', 'owner_screen_name'
         """
         return bind_api(
-            list_to_csv(screen_name), list_to_csv(user_id), slug, list_id,
-            owner_id, owner_screen_name,
-            api=self,
+            self, list_to_csv(screen_name), list_to_csv(user_id), slug,
+            list_id, owner_id, owner_screen_name,
             path='/lists/members/create_all.json',
             method='POST',
             allowed_param=['screen_name', 'user_id', 'slug', 'list_id',
@@ -1069,9 +1068,8 @@ class API:
                             'owner_id', 'owner_screen_name'
         """
         return bind_api(
-            list_to_csv(screen_name), list_to_csv(user_id), slug, list_id,
-            owner_id, owner_screen_name,
-            api=self,
+            self, list_to_csv(screen_name), list_to_csv(user_id), slug,
+            list_id, owner_id, owner_screen_name,
             path='/lists/members/destroy_all.json',
             method='POST',
             allowed_param=['screen_name', 'user_id', 'slug', 'list_id',
@@ -1087,7 +1085,7 @@ class API:
                             'cursor'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/lists/members.json',
             allowed_param=['owner_screen_name', 'slug', 'list_id', 'owner_id',
                            'cursor'], **kwargs
@@ -1100,7 +1098,7 @@ class API:
                             'owner_screen_name', 'owner_id'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/lists/members/show.json',
             allowed_param=['list_id', 'slug', 'user_id', 'screen_name',
                            'owner_screen_name', 'owner_id'], **kwargs
@@ -1112,7 +1110,7 @@ class API:
             :allowed_param: 'owner_screen_name', 'slug', 'owner_id', 'list_id'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/lists/subscribers/create.json',
             method='POST',
             allowed_param=['owner_screen_name', 'slug', 'owner_id', 'list_id'],
@@ -1125,7 +1123,7 @@ class API:
             :allowed_param: 'owner_screen_name', 'slug', 'owner_id', 'list_id'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/lists/subscribers/destroy.json',
             method='POST',
             allowed_param=['owner_screen_name', 'slug', 'owner_id', 'list_id'],
@@ -1141,7 +1139,7 @@ class API:
                             'skip_status'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/lists/subscribers.json',
             allowed_param=['owner_screen_name', 'slug', 'owner_id', 'list_id',
                            'cursor', 'count', 'include_entities',
@@ -1155,7 +1153,7 @@ class API:
                             'owner_id', 'list_id', 'user_id'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/lists/subscribers/show.json',
             allowed_param=['owner_screen_name', 'slug', 'screen_name',
                            'owner_id', 'list_id', 'user_id'], **kwargs
@@ -1165,7 +1163,7 @@ class API:
     def trends_available(self, *args, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-available """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/trends/available.json',
             **kwargs
         )
@@ -1176,7 +1174,7 @@ class API:
             :allowed_param: 'id', 'exclude'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/trends/place.json',
             allowed_param=['id', 'exclude'], **kwargs
         )
@@ -1187,7 +1185,7 @@ class API:
             :allowed_param: 'lat', 'long'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/trends/closest.json',
             allowed_param=['lat', 'long'], **kwargs
         )
@@ -1201,7 +1199,7 @@ class API:
                             'include_entities'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/search/tweets.json',
             allowed_param=['q', 'lang', 'locale', 'since_id', 'geocode',
                            'max_id', 'until', 'result_type', 'count',
@@ -1216,7 +1214,7 @@ class API:
                             'next'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path=f'/tweets/search/30day/{environment_name}.json',
             allowed_param=['query', 'tag', 'fromDate', 'toDate', 'maxResults',
                            'next'],
@@ -1231,7 +1229,7 @@ class API:
                             'next'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path=f'/tweets/search/fullarchive/{environment_name}.json',
             allowed_param=['query', 'tag', 'fromDate', 'toDate', 'maxResults',
                            'next'],
@@ -1245,7 +1243,7 @@ class API:
                             'max_results'
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/geo/reverse_geocode.json',
             allowed_param=['lat', 'long', 'accuracy', 'granularity',
                            'max_results'], **kwargs
@@ -1257,7 +1255,7 @@ class API:
             :allowed_param:
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path=f'/geo/id/{place_id}.json',
             **kwargs
         )
@@ -1270,7 +1268,7 @@ class API:
 
         """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/geo/search.json',
             allowed_param=['lat', 'long', 'query', 'ip', 'granularity',
                            'accuracy', 'max_results', 'contained_within'],
@@ -1281,7 +1279,7 @@ class API:
     def supported_languages(self, *args, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/developer-utilities/supported-languages/api-reference/get-help-languages """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/help/languages.json',
             require_auth=True, **kwargs
         )
@@ -1290,7 +1288,7 @@ class API:
     def configuration(self, *args, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/developer-utilities/configuration/api-reference/get-help-configuration """
         return bind_api(
-            *args, api=self,
+            self, *args,
             path='/help/configuration.json',
             require_auth=True, **kwargs
         )
index 8fe97f33d1a7d7e7683f452347c56a01300f1e1b..487afd230193c0aebe2db66e83dd956790ed4149 100644 (file)
@@ -167,8 +167,7 @@ def execute(api, method, path, *args, allowed_param=[], params=None,
         session.close()
 
 
-def bind_api(*args, **kwargs):
-    api = kwargs.pop('api')
+def bind_api(api, *args, **kwargs):
     http_method = kwargs.pop('method', 'GET')
     path = kwargs.pop('path')
     return execute(api, http_method, path, *args, **kwargs)