Mercurial > public > tweet-analysis
diff dependencies/python/url_controller.py @ 5:54e71cf6e324
refactor code
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Fri, 17 Sep 2021 17:42:30 +0200 |
parents | |
children | 6541622b6127 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dependencies/python/url_controller.py Fri Sep 17 17:42:30 2021 +0200 @@ -0,0 +1,13 @@ +def create_twitter_url(twitter_user, number_of_tweets): + """ + Create url to fetch `max_results` of tweets from `user` + :param twitter_user: string, required + :param number_of_tweets: int, required + :return: string url + """ + + formatted_max_results = 'max_results={}'.format(number_of_tweets) + formatted_user = 'query=from:{}'.format(twitter_user) + url = "https://api.twitter.com/2/tweets/search/recent?{}&{}".format(formatted_max_results, formatted_user) + + return url