Python Flask Create News Web Application

In this Python Flask article iam going to show you how to Create News Web Application, basically we are using News API website for getting our API Key. so simply you can open News API website after that create a New Account and get your API Key, for more information you can check the video for this article in the below.

 

Also you can check How To Build News Web Application In Django

Build News Web Application In Django 

What is News API ?

News API is a simple HTTP REST API for searching and retrieving live articles from all over the web. It can help you answer questions like:

  • What top stories is the NY Times running right now?
  • What new articles were published about the next iPhone today?
  • Has my company or product been mentioned or reviewed by any blogs recently?

You can search for articles with any combination of the following criteria:

  • Keyword or phrase. Eg: find all articles containing the word ‘Microsoft’.
  • Date published. Eg: find all articles published yesterday.
  • Source name. Eg: find all articles by ‘TechCrunch’.
  • Source domain name. Eg: find all articles published on nytimes.com.
  • Language. Eg: find all articles written in English.

You can sort the results in the following orders:

  • Date published
  • Relevancy to search keyword
  • Popularity of source

You need an API key to use the API – this is a unique key that identifies your requests. They’re free for development, open-source, and non-commercial use. You can get one here: get API key.

 

Installation

You can simply install News API by using pip command

 

 

What is Flask ?

Flask is a web framework. This means flask provides you with tools, libraries and technologies that allow you to build a web application. This web application can be some web pages, a blog, a wiki or go as big as a web-based calendar application or a commercial website.

Flask is part of the categories of the micro-framework. Micro-framework are normally framework with little to no dependencies to external libraries. This has pros and cons. Pros would be that the framework is light, there are little dependency to update and watch for security bugs, cons is that some time you will have to do more work by yourself or increase yourself the list of dependencies by adding plugins.

 

Installation

You can simply install Flask by pip

 

OK after the installation process, you need to open an IDE , so iam using Pycharm IDE. after that Create New Project. and now you need to create a folder that is called templates. and also you need to create a Python file at name of App.py. in the template you need to create two html files at name of bbc.html and index.html , now this is the structure of my project.

 

Flask News Web Application Structure
Flask News Web Application Structure

 

 

This is bbc.html file

 

 

And this is our App.py

 

So basically in the python file we have two view functions, the first one is for our Index and the second one is for bbc

 

Run the complete project and this will be the result

Python Flask Create News Web Application
Python Flask Create News Web Application

 

 

Also you can watch the complete video for this article

 

 

 

Subscribe and Get Free Video Courses & Articles in your Email

 

Share via
Copy link
Powered by Social Snap
×