开发者

Extracting replies using Twitter V2

开发者 https://www.devze.com 2022-12-07 22:07 出处:网络
I have been trying to get 开发者_运维百科the replies given a conversation id and every time I get the following response.Json response from twitter

I have been trying to get 开发者_运维百科the replies given a conversation id and every time I get the following response.Json response from twitter

My credential file is a json file and it is set as below:


{ "API key": "the api key", "API Key Secret": "the api secret", "Bearer Token": "bearer token", "Access Token": "access token", "Access Token Secret": "access token secret", "Client ID": "client id", "Client Secret": "client secret" }


I use the bearer token from the credential file as the header in the request url. The sample code for search url is below:


search_url = "https://api.twitter.com/2/tweets/search/recent" #Change to the endpoint you want to collect data from

 #change params based on the endpoint you are using
query_params = { 'query':'conversation_id:{}'.format(convo_id),  'tweet.fields':'author_id,conversation_id,in_reply_to_user_id,referenced_tweets,public_metrics',
                'pagination_token': {} }

I even tried running the program on Postman and got the same result there. The result is constant for any given conversation id.

I'm not sure where I have mistaken.

0

精彩评论

暂无评论...
验证码 换一张
取 消