python-twitter
python-twitter copied to clipboard
GetSearch return_json error
When I try to run:
search_results = api.GetSearch(term=q, count=count, return_json=True)
I get this error:
TypeError: GetSearch() got an unexpected keyword argument 'return_json'
I've looked through the source code but I do not understand what the issue it. According to the documentation and source return_json
should be a valid argument
I get the same issue.
I found out that the documentation is v3.2 and the current version is 3.3
I don't think that the latest master
branch has been uploaded to pypi.
@bear time for an update?
@williamstrong @thejoltjoker check this link here https://dev.twitter.com/rest/reference/get/search/tweets the twitter has removed the return_json argument from its API so it's obvious that you will get an error.If you want to get data in JSON format then make a dictionary from the key-value pairs using zip function or simply by dictionary_name['key'] = value
them import the JSON and dump that dictionary into it. You will get the required result.
Hey I'm kind of new to this, trying to use getSearch and it's not giving me an error but it's just returning an empty array?
@aadon94 Can you create a new issue? I assume that the problem is that the search isn't returning any results, but I can help you work through that. Also, do issues https://github.com/bear/python-twitter/issues/482 and https://github.com/bear/python-twitter/issues/478 address your issue?
@Satyam-Bhalla I resulted to iterating through the returned list and calling the method AsJsonString() on each object.
@williamstrong You can also access the raw json for each object by using its ._json
attribute. So like for a series of tweets:
tweets = api.GetSearch(term="twitter")
for tweet in tweets:
do_something(tweet._json)