0% found this document useful (0 votes)
15 views

BB College News Api

Uploaded by

arijit koley
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

BB College News Api

Uploaded by

arijit koley
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 55

KAZI NAZRUL UNIVERSITY

A project submission in partial fulfilment of the requirement for


the Honours degree of Bachelor of computer application.

NEWSAPI (ONLINE NEWS PORTAL)


Course Code – BCAHC605 Year of examination – 2022

Submitted by

Name and Reg no. of the students

1. AVIJIT GORAI (KNU19102003752)


2. SAYANTAN MAJI (KNU19102003973)
3. ATANU KARMAKAR (KNU19102003693)
4. ARIJIT KOLEY (KNU19102004300)

OF

BANWARILAL BHALOTIA COLLEGE


ACKNOWLEDGEMENT

I take this occasion to thank God, almighty for blessing us with his
grace and taking our endeavor to a successful culmination.

I extend my Computer Application and heartfelt thanks to our esteemed


guide, Mr. [Prosenjit Chatterjee] for providing me with the right
guidance and advice at the crucial junctures and for showing me the right
way.

I extend my Computer application thanks to our respected Head of the


College Mr. Amitava Basu, for allowing us to use the facilities
available.

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

This is to certify that this project entitled NEWSAPI submitted in partial


fulfillment of the degree of BCA , the Kazi Nazrul University , done by Mr.
AVIJIT GORAI(KNU19102003752) ,SAYANTAN MAJI(KNU19102003973), ATANU
KARMAKAR(KNU19102003693) , ARIJIT KOLEY(KNU19102004300), is an
authentic

Work carried out by them at Banwarilal Bhalotia college under my guidance.


The matter embodied in this project work has not been submitted earlier for
award of any degree or diploma to the best of my knowledge and belief and
project report is developed according to the “BCA PROJECT AND PROJECT
REPORT STANDARD 2022, KAZI NAZRUL UNIUVERSITY.”

Signature of the student Signature of the guide


SELF CERTIFICATE

This is to certify that the project report entitled “NEWSAPI” is done


by us is an authentic work carried out for the partial fullfillment of
the requirements for the award of the degree of BCA under guidance
of Prosenjit Chatterjee . we also certify that we are aware of the
“BCA PROJECT AND PROJECT REPORT STANDARD 2022 , KAZI NAZRUL
UNIUVERSITY”, issued by the Kazi Nazrul University and this project report is
based on the standard . The matter embodied in this project work has not
been submitted earlier for the award of any degree or diploma to the best of
my knowledge and belief.

Signature of the students: 1.

2.

3.

4.

Name of the students : 1.Avijit Gorai, (KNU19102003752)

2.Sayantan Maji, (KNU19102003973

3.Atanu Karmakar, (KNU19102003693)

4.Arijit Koley (KNU19102004300)

College name : Banwarilal Bhalotia college


SYNOPSIS

In this project we have develop an Online News Portal website. It is a dynamic


system. It can be maintain and changed easily because it is based on database.
It’s contain web pages that are generated in real-time. These pages include
Web scripting code, such as Python. It is fully secured from unauthorized
access. In a word it can say that our Online News Portal website is a completely
dynamic website.

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

4. Definition of the problem

5. System requirements

6. System planning

7. Software requirements

8. Hardware requirements

9. Justification for particular software

10. Security issues

11. Cost and benefit analysis

12. Detailed life cycle of the project

13. Software process model

14. Code of the project

15. Security testing of the project

16. Screen shots of the project

17. Limitations

18. Conclusion

19. Future scope of the project

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.

2. The objective of this project is to provide the daily news.

3. The objective of this project is to provide the breaking


news.

4. It makes use of various technologies to get required


crime oriented information more quickly, easily, colourfully
and attractively.

5. To do this for more widely coverage of distribution and


faster dissemination of information in a more timely manner.

6. Anytime, anywhere, anyone can know about the news or


information by internet at low cost.

7. Dynamically provides facility.

8. To add any new information without any complexity.


Category :
Online News Portal, can lead to error free, secure,
reliable and fast management system. It can assist the
user to concentrate on their other activities rather to
concentrate on the record keeping. It is a web based
application and multiuser.

The aim is to automate its existing manual system


by the help of computerized equipments and full-
fledged computer software, fulfilling their
requirements, so that their valuable
data/information can be stored for a longer
period with easy accessing and manipulation of
the same. Basically the project describes how to
manage for good performance and better services
for the clients.
Theoretical Background :
The Software theoretical background is produced at
the culmination of the analysis task. The function and
performance allocated to software as part of system
engineering are refined by establishing a complete
information description, a detailed functional and
behavioral description, an indication of performance
requirements and design constraints, appropriate
validation criteria, and other data pertinent to
requirements.
Definition of the Problem :
In this project we will try to create a online news portal by using
python programming language. Now-a-days we live in age of
Information Communication and Technology. We can’t think a single
moment without technology. From morning to night, we need help
of the technology. This is the revolutionary time of computer
technology. Most of the works depends on web application. For this
reason, anytime, anywhere, anyone can access a website by internet
at low cost and we can find our expectable and most update
information from website. At present information is one the most
valuable resource of the current world. We have developed our
project so that we can aware the people.
System requirements specification:
 System needs store information about new entry of
News.
 System needs to help the internal staff to keep
information of Category and find them as per various
queries.
 System need to maintain quantity record.

 System need to keep the record of Latest News.

 System need to update and delete the record

.  System also needs a search area.

 It also needs a security system to prevent data.


System Planning:
Pert chart:
PERT chart is organized for events, activities or tasks. It is a
scheduling device that shows graphically the order of the tasks to be
performed. It enables the calculation of the critical path. The time
and cost associated along a path is calculated and the path requires
the greatest amount of elapsed time in critical path.

Design GUI
Code GUI part
part

Integrate and
test

Specification

Write user Implementation


manual

PERT chart representation


SOFTWARE REQUIREMENTS:
Name of the components specification

Operating System Windows 10, Windows 8,


Windows 7, Windows XP
Language Python, CSS, HTML

Browser Mozilla/Opera/Chrome

Scripting language enable Python

HARDWARE REQUIREMENTS:
NAME OF THE COMPONENTS SPECIFICATION

Processor Pentium III 630MHz

RAM 128 MB

Hard disk 20 GB

Monitor 15” colour monitor

Keyboard 122 keys


Justification for particular software:
HTML :
HTML stands for Hyper Text Markup Language, which is the most
widely used language on Web to develop web pages. HTML was
created by Berners-Lee in late 1991 but "HTML 2.0" was the first
standard HTML specification which was published in 1995. HTML
4.01 was a major version of HTML and it was published in late 1999.
Though HTML 4.01 version is widely used but currently we are having
HTML-5 version which is an extension to HTML 4.01, and this version
was published in 2012.

Why to Learn HTML?

 Create Web site - You can create a website or customize an


existing web template if you know HTML well.
 Become a web designer - If you want to start a carrier as a
professional web designer, HTML and CSS designing is a must
skill.
 Understand web - If you want to optimize your website, to
boost its speed and performance, it is good to know HTML to
yield best results.
 Learn other languages - Once you understands the basic of
HTML then other related technologies like javascript, php, or
angular are become easier to understand.
What is CSS?
Cascading Style Sheets, fondly referred to as CSS, is a simple design
language intended to simplify the process of making web pages
presentable.
CSS handles the look and feel part of a web page. Using CSS, you can
control the colour of the text, the style of fonts, the spacing between
paragraphs, how columns are sized and laid out, what background
images or colours are used, layout designs, variations in display for
different devices and screen sizes as well as a variety of other effects.
Most commonly, CSS is combined with the markup languages HTML
or XHTML
 CSS saves time − You can write CSS once and then reuse same
sheet in multiple HTML pages. You can define a style for each
HTML element and apply it to as many Web pages as you want.
 Pages load faster − If you are using CSS, you do not need to
write HTML tag attributes every time. Just write one CSS rule of
a tag and apply it to all the occurrences of that tag. So less code
means faster download times.
 Easy maintenance − To make a global change, simply change
the style, and all elements in all the web pages will be updated
automatically.
 Superior styles to HTML − CSS has a much wider array of
attributes than HTML, so you can give a far better look to your
HTML page in comparison to HTML attributes.
 Multiple Device Compatibility − Style sheets allow content to
be optimized for more than one type of device. By using the
same HTML document, different versions of a website can be
presented for handheld devices such as PDAs and cell phones or
for printing.
 Global web standards − Now HTML attributes are being
deprecated and it is being recommended to use CSS. So its a
good idea to start using CSS in all the HTML pages to make
them compatible to future browsers.
 Python:
Python is a high-level, interpreted, interactive and object-oriented
scripting language. Python is designed to be highly readable. It uses
English keywords frequently where as other languages use
punctuation, and it has fewer syntactical constructions than other
languages.

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.

Web page security :


The Internet is a dangerous place! With great regularity, we hear
about websites becoming unavailable due to denial of service
attacks, or displaying modified (and often damaging) information on
their homepages.
Cost and benefit analysis :
Software cost comprises a small percentage of overall computer-
based system cost. There are a number of factors, which are
considered, that can affect the ultimate cost of the software such as -
human, technical, Hardware and Software availability etc. The main
point that was considered during the cost estimation of project was
its sizing. In spite of complete software sizing, function point and
approximate lines of code were also used to "size" each element of
the Software and their costing. The cost estimation done by me for
Project also depend upon the baseline metrics collected from past
projects and these were used in conjunction with estimation
variables to develop cost and effort projections. We have basically
estimated this project mainly on two bases.

1) Effort Estimation - This refers to the total man-hours required


for the development of the project. It even includes the time
required for doing documentation and user manual.

2) Hardware Required Estimation - This includes the cost of the


PCs and the hardware cost required for development of this
project.
DETAILED LIFE CYCLE OF THE PROJECT

1.Data Flow Diagram


A data flow diagram is a short road map for that graphically represents how
the data moves through the existing system .we have used data flow diagram
in design process. The data flow diagram provides facilitating communication
between us and user. DFD shows what kinds of information will be input to
and output from the system, where the data will come from and go to, and
where the data will be stored. It does not show information about the timing
of processes, or information about whether processes will operate in sequence
or in parallel.

Data flow diagram of Online News Portal for the USER

Reque Request
https://newsapi.org
Newspie Web App Third Party API
VISITOR
Response
Software process models :

1.WATERFALL MODEL :

The waterfall model is probably the oldest and the best-known


model as far as software development process models is concerned.
The role of the waterfall model in software engineering is as
important as its role in software testing. Of course, over the years,
there are a number of other software process models which have
been designed and implemented, but what is true is that a lot of
them are based (in some way or the other) on the fundamental
principle of the waterfall model.

ANALYSIS

SYSTEM DESIGN

IMPLEMENTATION

TESTING

DEPLOYMENT OF
SYSTEM

MAINTENANCE
Advantages of waterfall model:

1. Simple and easy to understand and use.


2. Easy to manage due to the rigidity of the model – each phase
has specific deliverables and a review process.
3. Phases are processed and completed one at a time.
4. Works well for smaller projects where requirements are very
well understood.

Disadvantages of waterfall model:

1. Once an application is in the testing stage, it is very difficult to


go back and change something that was not well-thought out
in the concept stage.
2. No working software is produced until late during the life
cycle.
3. High amounts of risk and uncertainty.
4. Not a good model for complex and object-oriented projects.
5. Poor model for long and ongoing projects.
6. Not suitable for the projects where requirements are at a
moderate to high risk of changing.
7. The project is short.
Code
Of
the project
[[source]
]
name = "pypi"

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'])

CATEGORIES = ('general', 'sports', 'business',


'entertainment', 'health',
'science', 'technology')
with open('data/countries.json') as json_file:
COUNTRIES = json.load(json_file)

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.route('/', methods=['GET', 'POST'])


def root():
''' Base URL redirect to the first page of
general category. '''
return redirect(url_for('category',
category='general', page=1))

@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')

def do_post(page, category='general',


current_query=None):
''' Helper method that handles POST request
basing on the input. '''
new_query = request.form.get('search_query')
country = request.form.get('country')
next_page = request.form.get('next_page')
previous_page =
request.form.get('previous_page')
if new_query is not None and new_query != '':
return redirect(url_for('search',
query=new_query, page=1))
if country is not None and country !=
get_cookie('country'):
response = make_response(
redirect(url_for('category',
category=category, page=1)))
response.set_cookie('country', country)
return response
if next_page is not None:
page = int(next_page) + 1
elif previous_page is not None:
page = int(previous_page) - 1
if category == 'search':
return redirect(url_for('search',
query=current_query, page=page))
return redirect(url_for('category',
category=category, page=page))

def parse_articles(response: dict) -> list:


''' Parses articles fetched from News API.
Returns:
A list of dicts containing publishing date,
title, URL and source of
articles.
'''
parsed_articles = []
if response.get('status') == 'ok':
for article in response.get('articles'):
parsed_articles.append({
'published_at':

parser.isoparse(article['publishedAt']
).strftime('%d-
%m %H:%M'),
'title':
article['title'],
'url':
article['url'],
'source':
article['source']['name']
})
return parsed_articles

def count_pages(response: dict) -> int:


''' Helper method that counts number of total
pages basing on total
results from News API response and
PAGE_SIZE.
Returns:
An int with a number of total pages. '''
if response.get('status') == 'ok':
return (-(-response.get('totalResults',
0) // PAGE_SIZE))
return 0

def render(articles, page, pages, country,


category):
''' Renders the template with appropriate
variables. Up to 12 pages
allowed. '''
pages = pages if pages <= 12 else 12
return render_template(CONFIG['VARIOUS']
['TEMPLATE'],
articles=articles,
categories=CATEGORIES,
category=category,
countries=COUNTRIES,
country=country,
page=page,
pages=pages)

def get_cookie(key: str) -> Union[str, None]:


''' Helper method that gets cookie's value.
Returns:
A string with a value of a cookie with
provided key. If a key is
missing, None is returned.
'''
return request.cookies.get(key)

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.

White Box Testing:


In this technique, the close examination of the logical parts through the
software are tested by cases that exercise species sets of conditions or loops.
all logical parts of the software checked once. errors that can be corrected
using this technique are typographical errors, logical expressions which should
be executed once may be getting executed more than once and error resulting
by using wrong controls and loops. When the box testing tests all the
independent part within a module a logical decisions on their true and the
false side are exercised , all loops and bounds within their operational bounds
were exercised and internal data structure to ensure their validity were
exercised once.

Black Box Testing:


This method enables the software engineer to device sets of input techniques
that fully exercise all functional requirements for a program. black box testing
tests the input, the output and the external data. it checks whether the input
data is correct and whether we are getting the desired output.

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 :

Our project is only a humble venture to satisfy the needs to manage


their project work. Several user friendly coding have also adopted.
This package shall prove to be a powerful package in satisfying all the
requirements of the school. The objective of software planning is to
provide a frame work that enables the manger to make reasonable
estimates made within a limited time frame at the beginning of the
software project and should be updated regularly as the project
progresses.

At the it is concluded that we have made effort on following points


1. A description of the background and context of the project and its
relation to work already done in the area.
2. Made statement of the aims and objectives of the project.  The
description of Purpose, Scope, and applicability.
3. We define the problem on which we are working in the project.
4. We describe the requirement Specifications of the system and the
actions that can be done on these things.
5. We understand the problem domain and produce a model of the
system, which describes operations that can be performed on the
system.
6. We included features and operations in detail, including screen layouts.
7. We designed user interface and security issues related to system.
8. Finally the system is implemented and tested according to test cases.
Future scope of the project :
In a nutshell, it can be summarized that the future scope of the project circles
around maintaining information regarding:

1. We can add printer in future.


2. We can give more advance software for Online News Portal including more
facilities.
3. We will host the platform on online servers to make it accessible
worldwide.
4. Integrate multiple load balancers to distribute the loads of the system.
5. Create the master and slave database structure to reduce the overload of
the database queries
6. Implement the backup mechanism for taking backup of codebase and
database on regular basis on different servers.

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 :

 Google for problem solving.

 https://www.tutorialspoint.com/

 http://www.javatpoint.com/

https://newsapi.org

https://www.geeksforgeeks.org/

THANK YOU

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy