Skip to content

Instantly share code, notes, and snippets.

Last active September 12, 2021 17:15
What would you like to do?
def news_api_request(url: str, **kwargs) -> list:
Sends GET request to News API endpoint
url: full URL for endpoint
kwargs: please refer to
News API documentations:
(apiKey argument is required)
list containing data for each article in response
params = kwargs
res = requests.get(url, params=params)
articles = res.json().get('articles')
return articles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment