Mercurial > public > tweet-analysis
comparison 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 |
comparison
equal
deleted
inserted
replaced
4:cfd876570008 | 5:54e71cf6e324 |
---|---|
1 def create_twitter_url(twitter_user, number_of_tweets): | |
2 """ | |
3 Create url to fetch `max_results` of tweets from `user` | |
4 :param twitter_user: string, required | |
5 :param number_of_tweets: int, required | |
6 :return: string url | |
7 """ | |
8 | |
9 formatted_max_results = 'max_results={}'.format(number_of_tweets) | |
10 formatted_user = 'query=from:{}'.format(twitter_user) | |
11 url = "https://api.twitter.com/2/tweets/search/recent?{}&{}".format(formatted_max_results, formatted_user) | |
12 | |
13 return url |