A bit overview, it uses mediastack.com API to get news and get JSON data back. Then it is parsed using a json library.
Note: To run the app you have to add mediastack.com key. I have taken this step to due to limited access to daily request for News. Getting a key would take just few seconds :)
- Visit mediastack.com to get your API Key
- Copy your API Key from accounts section
- Open
views.py
(in your app)- Add the following line:
api_key="YOUR_API_KEY"
- if you are from adifferent country you can cjange the country as follows in views.py:
url = f'http://api.mediastack.com/v1/news?access_key={api_key}&keywords={search}&countries=ke'
replace 'ke' with your countries initials eg espn or us
- Dennis Ivy For teaching me Django