Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client.get_tweet() doesn't return fields data #2015

Closed
isaswa opened this issue Nov 13, 2022 · 1 comment
Closed

Client.get_tweet() doesn't return fields data #2015

isaswa opened this issue Nov 13, 2022 · 1 comment
Labels
Invalid This is not valid

Comments

@isaswa
Copy link

isaswa commented Nov 13, 2022

I tried searching on stackoverflow but there seems to be no example with tweepy v4.
I also checked the doc about this problem:
https://docs.tweepy.org/en/v4.6.0/faq.html#why-am-i-not-getting-expansions-or-fields-data-with-api-v2-using-client

when I tried the codes below:

print(client.get_tweet(id=id, media_fields=['url']))
print(client.get_tweet(id=id, media_fields=['url']).includes)
print(client.get_tweet(id=id, media_fields=['url']).includes['url'])

all of them printed out empty includes fields
the last line raised the error KeyError: url, which means the function does not actually return the fields I ask for.

@isaswa isaswa closed this as completed Nov 13, 2022
@Harmon758
Copy link
Member

There is an Examples page in the documentation.

Response.includes returns objects requested through expansions.
You aren't requesting any expansions, so Response.includes is an empty dictionary as expected.

Without expansions, there are no media objects for that Twitter API endpoint to return, since it provides Tweets, so there are no media objects for which to return the single url field that you are requesting.

@Harmon758 Harmon758 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 15, 2022
@Harmon758 Harmon758 added the Invalid This is not valid label Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Invalid This is not valid
Projects
None yet
Development

No branches or pull requests

2 participants