March 2019
Beginner
490 pages
12h 40m
English
In the previous script, we can add a search() function to search for and retrieve tweets from a specific search parameter. In this example, we are using the 'q' parameter with the 'python' value as search term. For this task, we can use the search endpoint at https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets.html. The endpoint (https://api.twitter.com/1.1/search/tweets.json) requires the search term as a mandatory parameter.
You can find the following code in the twitter_search_tag.py file:
#! /usr/bin/python3import requestsimport requests_oauthlibimport sysimport jsondef verify_credentials(auth_obj): url = 'https://api.twitter.com/1.1/account/verify_credentials.json' response = requests.get(url, ...
Read now
Unlock full access