Mercurial > public > tweet-analysis
view 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 source
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