tweepy / tweepy

Twitter for Python!
https://www.tweepy.org
MIT License
10.37k stars 4.61k forks source link

BUG Feedback: lookup_users use GET request in Official Twitter Docs #1654

Closed lidd77 closed 2 years ago

lidd77 commented 2 years ago

Hey,
I find tweep do lookup_users with "POST" request style,
but in official Twitter docs , it's "GET" request style .

def lookup_users(self, user_ids=None, screen_names=None, *args, **kwargs):
        """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup
            allowed_param= 'user_id', 'screen_name', 'include_entities',
                           'tweet_mode'
        """
        return bind_api(
            api=self,
            path='/users/lookup.json',
            payload_type='user', payload_list=True,
            method='POST', 
            allowed_param=['user_id', 'screen_name', 'include_entities',
                           'tweet_mode']
        )(list_to_csv(user_ids), list_to_csv(screen_names), *args, **kwargs)

SO its a bug for Tweepy ?

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup

Harmon758 commented 2 years ago

The documentation on that page says (multiple times), "You are strongly encouraged to use a POST for larger requests." Since the endpoint supports it, Tweepy simply uses POST for all requests to the endpoint. This is not a bug.

lidd77 commented 2 years ago

@Harmon758 could Tweepy can use GET for this ? when we use POST method to get larger requests , Twitter will limit this user's all Tweepy functions which use POST request.

Harmon758 commented 2 years ago

There is no advantage to using GET here. In fact, it's likely that it will cause issues with larger requests to this endpoint. I'm not sure what exactly you're saying is the downside for using POST, but if you're talking about rate limits, they are per endpoint. There shouldn't be any rate limit encompassing all POST requests to all API endpoints.

lidd77 commented 2 years ago

There is no advantage to using GET here. In fact, it's likely that it will cause issues with larger requests to this endpoint. I'm not sure what exactly you're saying is the downside for using POST, but if you're talking about rate limits, they are per endpoint. There shouldn't be any rate limit encompassing all POST requests to all API endpoints.

Do you mean we can support GET request ? for millions of followers ID , request 100 per 2 seconds , so it's larger requests ?? I mean to divide big number into small number , maybe its not larger request ?

Harmon758 commented 2 years ago

Again, there's no reason to use GET rather than POST for this endpoint.