`expansions` does not work with `author_id`
kevinmartinjos opened this issue · comments
Kevin Martin Jose commented
In the example mentioned in the readme:
from TwitterAPI import TwitterAPI
api = TwitterAPI(consumer_key, consumer_secret, access_token_key, access_token_secret, api_version='2')
r = api.request('tweets/search/recent', {
'query':'pizza',
'tweet.fields':'author_id',
'expansions':'author_id'})
for item in r:
print(item)
The output is:
{'author_id': '1391673635899838465', 'id': '1538467334440075266', 'text': 'Ben: salata mı yesem pizza mı\nİç ses: https://t.co/ocGwL5idxW'}
{'author_id': '933644807498620928', 'id': '1538467332384768000', 'text': 'Am I fat bitch for eating leftover pizza? Yes. Am I going to keep doing it? Also yes'}
{'author_id': '25718318', 'id': '1538467331931877377', 'text': 'RT @milaghorayeb: I know you live in an open air prison but we have Gay Pizza https://t.co/ZyV0CNQawO'}
....
As you can see, there is no includes
object. Looks like a bug, right?
geduldig commented
Hi -
Nope, not a bug. Print r.text
and you will see the full response with includes
, etc. Also, look at the examples for "hydrate" which gets you for fields for any particular ID.
Kevin Martin Jose commented
Ah yes you are right - doing json.loads(r.text)
got me what I wanted. Thanks for responding!