BB College News Api
BB College News Api
Submitted by
OF
I take this occasion to thank God, almighty for blessing us with his
grace and taking our endeavor to a successful culmination.
I would like to thank the other faculty members also, at this occasion. Last
but not the least, I Would like to thank my friends and family for the support
and encouragement they have given me during the course of our work.
CERTIFICATE FROM PROJECT GUIDE
2.
3.
4.
To create the software, we have worked on all possible types of basic codes
used for principle design based on mainly on PYTHON, CSS and HTML. Here we
have used incremental model to create the software.
We have collected all kinds of information related to this software from the
customer. Actually it is one kind of Customized software products. The project
background model specially designed on the basis of certain web programming
language like python, HTML etc. In following section here we are going to give
a brief description about this language in this project.
INDEX
1. Main report
2. Category
3. Theoretical background
5. System requirements
6. System planning
7. Software requirements
8. Hardware requirements
17. Limitations
18. Conclusion
20 Reference
MAIN REPORT
Objective :
1. The objective of this project is to develop a web
application for Online News Paper website that can aware
the people.
Design GUI
Code GUI part
part
Integrate and
test
Specification
Browser Mozilla/Opera/Chrome
HARDWARE REQUIREMENTS:
NAME OF THE COMPONENTS SPECIFICATION
RAM 128 MB
Hard disk 20 GB
Why python :
Easy-to-learn − Python has few keywords, simple
structure, and a clearly defined syntax. This allows the
student to pick up the language quickly.
Easy-to-read − Python code is more clearly defined and
visible to the eyes.
Easy-to-maintain − Python's source code is fairly easy-to-
maintain.
A broad standard library − Python's bulk of the library is
very portable and cross-platform compatible on UNIX,
Windows, and Macintosh.
Interactive Mode − Python has support for an interactive
mode which allows interactive testing and debugging of
snippets of code.
Portable − Python can run on a wide variety of hardware
platforms and has the same interface on all platforms.
Security issues:
Here are a few of the most common threat vectors that can affect an
operating system.
Malware :
Malware is short for malicious software, which encompasses a range
of attack vectors such as viruses, worms, trojans, and rootkits.
Malware is injected into a system without the owner’s consent, or by
masquerading as legitimate software, with the objective of stealing,
destroying or corrupting data, or compromising the device.
Reque Request
https://newsapi.org
Newspie Web App Third Party API
VISITOR
Response
Software process models :
1.WATERFALL MODEL :
ANALYSIS
SYSTEM DESIGN
IMPLEMENTATION
TESTING
DEPLOYMENT OF
SYSTEM
MAINTENANCE
Advantages of waterfall model:
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
pylint = "*"
yapf = "*"
flake8 = "*"
[packages]
requests = "*"
flask = "*"
python-dateutil = "*"
requests-cache = "*"
[requires]
python_version = "3.8.6"
import configparser
import json
import logging
import os
from typing import Union
import requests
import requests_cache
from dateutil import parser
from flask import (Flask, make_response, redirect,
render_template, request,
url_for)
CONFIG = configparser.ConfigParser()
CONFIG.read('config.ini')
API_KEY = os.environ.get('NEWS_API_KEY')
TOP_HEADLINES = CONFIG['ENDPOINTS']
['TOP_HEADLINES']
EVERYTHING = CONFIG['ENDPOINTS']['EVERYTHING']
PAGE_SIZE = int(CONFIG['VARIOUS']['PAGE_SIZE'])
logging.basicConfig(level=logging.DEBUG)
requests_cache.install_cache(cache_name='news_cache
',
backend='sqlite',
expire_after=300)
APP = Flask(__name__)
SESSION = requests.Session()
SESSION.headers.update({'Authorization': API_KEY})
@APP.errorhandler(404)
def page_not_found(error):
''' Not existing pages redirect to the first
page of general category. '''
return redirect(url_for('category',
category='general', page=1))
@APP.route('/category/<string:category>',
methods=['GET', 'POST'])
def category(category):
''' Handles category route.
Parameters:
- name: category
in: path
description: Name of the news category
- name: page
in: query
description: Number of the page
'''
page = request.args.get('page', default=1,
type=int)
if page < 1:
return redirect(url_for('category',
category=category, page=1))
if request.method == 'POST' and category in
CATEGORIES:
return do_post(page, category)
if category in CATEGORIES:
params = {'page': page, 'category':
category, 'pageSize': PAGE_SIZE}
country = get_cookie('country')
if country is not None:
params.update({'country': country})
response = SESSION.get(TOP_HEADLINES,
params=params)
if response.status_code == 200:
pages = count_pages(response.json())
if page > pages:
page = pages
return redirect(
url_for('category',
category=category, page=page))
articles =
parse_articles(response.json())
return render(articles, page, pages,
country, category)
elif response.status_code == 401:
return
render_template(CONFIG['VARIOUS']['401_TEMPLATE'])
return redirect(url_for('category',
category='general', page=page))
@APP.route('/search/<string:query>',
methods=['GET', 'POST'])
def search(query: str):
''' Handles category route.
Parameters:
- name: query
in: path
description: Query string to be searched
- name: page
in: query
description: Number of the page
'''
page = request.args.get('page', default=1,
type=int)
if page < 1:
return redirect(url_for('search',
query=query, page=1))
params = {
'qInTitle': query,
'sortBy': 'relevancy',
'page': page,
'pageSize': PAGE_SIZE
}
if request.method == 'POST':
return do_post(page, category='search',
current_query=query)
response = SESSION.get(EVERYTHING,
params=params)
pages = count_pages(response.json())
if page > pages:
page = pages
return redirect(url_for('search',
query=query, page=page))
articles = parse_articles(response.json())
return render(articles,
page,
pages,
country=get_cookie('country'),
category='search')
parser.isoparse(article['publishedAt']
).strftime('%d-
%m %H:%M'),
'title':
article['title'],
'url':
article['url'],
'source':
article['source']['name']
})
return parsed_articles
if __name__ == '__main__':
APP.run()
<!DOCTYPE
html>
<meta charset="utf-8">
<title>Redirecting to https://newspie.eu.pythonanywhere.com/</title>
<meta http-equiv="refresh" content="0;
URL=https://newspie.eu.pythonanywhere.com/">
<link rel="canonical" href="https://newspie.eu.pythonanywhere.com/">
Security testing of the project:
Testing is vital for the success of any software. no system
design is ever perfect. Testing is also carried in two phases.
first phase is during the software engineering that is during
the module creation. second phase is after the completion of
software. this is system testing which verifies that the whole
set of programs hanged together.
Alpha Testing:
Acceptance testing is also sometimes called alpha testing. Be spoke systems
are developed for a single customer. The alpha testing proceeds until the
system developer and the customer agree that the provided system is an
acceptable implementation of the system requirements.
Beta Testing:
On the other hand, when a system isto be marked as a software product,
another process called beta testing is often conducted. During beta testing, a
system is delivered among a number of potential users who agree to use it.
The customers then report problems to the Project Report of Online News
Portal Page - 35 developers. This provides the product for real use and detects
errors which may not have been anticipated by the system developers.
Unit Testing:
Each module is considered independently. it focuses on each unit of software
as implemented in the source code. it is white box testing.
Integration Testing:
Integration testing aims at constructing the program structure while at the
same constructing tests to uncover errors associated with interfacing the
modules. modules are integrated by using the top down approach.
Validation Testing:
Validation testing was performed to ensure that all the functional and
performance requirements are met.
System Testing:
It is executing programs to check logical changes made in it with intention of
finding errors. a system istested for online response, volume of transaction,
recovery from failure etc. System testing is done to ensure that the system
satisfies all the user requirements.
SCREENSHOTS
OF
THE
PROJECTS
LIMITATIONS :
Although I have put my best efforts to make the software flexible, easy to
operate but limitations cannot be ruled out even by me. Though the software
presents a broad range of options to its users some intricate options could not
be covered into it; partly because of logistic and partly due to lack of
sophistication. Paucity of time was also major constraint, thus it was not
possible to make the software foolproof and dynamic. Lack of time also
compelled me to ignore some part such as storing old result of the candidate
etc. Considerable efforts have made the software easy to operate even for the
people not related to the field of computers but it is acknowledged that a
layman may find it a bit problematic at the first instance. The user is provided
help at each step for his convenience in working with the software.
1. Excel export has not been developed for News, Category due to
some criticality.
2. The transactions are executed in off-line mode, hence on-line
data for Latest News, Weather News capture and modification
is not possible.
3. Off-line reports of News, Bollywood News, Latest News cannot
be generated due to batch mode execution.
CONCLUSION :
The above mentioned points are the enhancements which can be done to
increase the applicability and usage of this project. Here we can maintain the
records of News and Category. Also, as it can be seen that now-a-days the
players are versatile, i.e. so there is a scope for introducing a method to
maintain the Online News Portal. Enhancements can be done to maintain all
the News, Category, Latest News, Weather News, Bollywood News. We have
left all the options open so that if there is any other future requirement in the
system by the user for the enhancement of the system then it is possible to
implement them.In the last we would like to thanks all the persons involved in
the development of the system directly or indirectly. We hope that the project
will serve its purpose for which it is develop there by underlining success of
process.
REFERENCE :
https://www.tutorialspoint.com/
http://www.javatpoint.com/
https://newsapi.org
https://www.geeksforgeeks.org/
THANK YOU