Price Comparison Using Python: (Reaccredited With A' Grade by NAAC)
Price Comparison Using Python: (Reaccredited With A' Grade by NAAC)
Submitted by
S. Gayathri (1401209) N. Gomathi (1401210)
M. Gomathi Priya (1401211) K. Harilakshmi (1401212))
A Project Report Submitted to the
Guided by
Ms. S. Ramalakshmi, MCA., M.Phil.,
Assistant Professor
1
CERTIFICATE
Principal
Submitted for viva-voce examination held at Sri Sarada College for Women
(An Autonomous Institution), Tirunelveli on ______________
Place: 1.
Date: 2.
External Examiners
2
DECLARATION
We hereby declare that the project work done for the award of degree Bachelor of
Computer Applications on “Price Comparison Using Python” is our original work. The
data and the report submitted are true and correct to the best of our knowledge.
Internal Guide
(Ms. S. Rama Lakshmi, MCA., M.Phil.,)
1. S. Gayathri 20181261401209
2. N. Gomathi 20181261401210
4. K. Harilakshmi 20181261401212
3
ACKNOWLEDGEMENT
First and foremost, we would like to thank and praise God Almighty for successfully
completing the project.
We take immense pleasure in thanking our parents who given moral support and
encouragement throughout the work.
We are highly indebted to thank Ms. S. Ramalakshmi, MCA., M.Phil., our internal
guide for her guidance and constant supervision as well as for providing necessary information
regarding the project and also for her support in completing the project.
My special thanks to all the staff members of department for their valuable advice and
suggestions.
I feel great pleasure to thank all my friends for giving support to do my project successfully.
I also take deep sense of gratitude to one and all who have directly or indirectly helped me
in making this project a worthy endeavor
4
TABLE OF CONTENTS
S. No TITLE Pg. No
1. Synopsis
2. System Environment
2.1 Hardware Specification
2.2 Software Specification
2.3 Software Description
3. System Analysis
3.1 Introduction
3.2 Existing System
3.3 Proposed System
3.4 Need for Proposed System
4. System Design
4.1 Introduction
4.2 Input Design
4.3 Output Design
4.4 Database Design
5. System Development
5.1 Introduction
5.2 Process description
6. Future Enhancement
7. Conclusion
8. Bibliography
9. Annexure
9.1 Data flow diagram
9.2 Screen design
9.3 Source code
5
1. SYNOPSIS
6
2. SYSTEM ENVIRONMENT
Monitor : DELL
RAM : 3.77 GB
CD – ROM : 238.35 GB
7
2.3 Software Description
Introduction to Python
Python is a powerful modern computer programming language. It bears some
similarities to Fortran, one of the earliest programming languages, but it is much more powerful
than Fortran. Python allows you to use variables without declaring them (i.e., it determines types
implicitly), and it relies on indentation as a control structure. You are not forced to define classes
in Python (unlike Java) but you are free to do so when convenient. Python was developed by Guido
van Rossum, and it is free software. Free as in “free beer,” in that you can obtain Python without
spending any money. But Python is also free in other important ways, for example you are free to
copy it as many times as you like, and free to study the source code, and make changes to it. There
is a worldwide movement behind the idea of free software, initiated in 1983 by Richard Stallman.1
This document focuses on learning Python for the purpose of doing mathematical calculations. We
assume the reader has some knowledge of basic mathematics, but we try not to assume any
previous exposure to computer programming, although some such exposure would certainly be
helpful. Python is a good choice for mathematical calculations, since we can write code quickly,
test it easily, and its syntax is similar to the way mathematical ideas are expressed in the
mathematical literature. By learning Python, you will also be learning a major tool used by many
web developers.
Features of Python
Python programming language is dominating other programming languages such as C,
C++ or Java. Python is an Object-Oriented, High-Level multi-paradigm programming language
with dynamic features. It was designed by Guido Van Rossum who was a Dutch programmer. It
is one of the most favored programming languages used worldwide. It has undergone more than
25 years of the successful span and it is one of the fastest growing programming languages. Python
itself reveals its success story and a promising future ahead. Python programming language is best
used for application development, web application or web development, game development,
system administration, scientific computing etc. Python has gained more popularity than ever.
Python provides significant features which catch every programmer’s attention. Python is very
simple to read and write hence, it reduces the confusion among the programmers. Surprisingly,
one of the biggest tech company Google uses Python for their numerous applications and has a
full devoted portal to Python. Here are some features of Python that can project the reasons why it
has become so popular.
• Most of the other programming languages have supports issues. Also, some of them lack
in the documentation which makes it difficult for a programmer to build his project.
8
• Python doesn’t have these issues. It has been around for a long time, so there are plenty of
documentation, tutorials, guides and much more to help a programmer.
• Also, it has an active and rich community who ensures to provide help and supports to the
developers. The community consists of many experienced developers and programmer
who provides support at any time.
2. Easy to code and write
• Python has a simple and readable code as compared to other programming languages like
Java, C or C++. The code is expressed in an easy manner which can be simply interpreted
even by a beginner programmer.
• Although to master Python programming, it will require a lot of effort and time, but to learn
this language from scratch is easy for a novice. Even looking at the code he can tell what
the code is supposed to do.
3. Open-source and availability
• Python is an open-source programming language that means its source code is publically
available.
4. Standard Library
• Python comes with a huge standard library. These libraries eliminate the effort to write a
function or code.
• The library consists of many inbuilt functions and pre-written codes, so you don’t have to
write a code for every single thing.
• This contains expressions, unit-testing, web browsers, databases, threading and much
more.
5. Cross-Platform Language
• Python can run smoothly on different operating systems such as Windows, Linux, Ubuntu,
etc. so it can be interpreted that it is a portable language.
• That means if you’ve written your code for the Windows platform, you can also run it on
a Mac platform.
• There would be no need to make changes to your code to run it on any other platform.
9
Applications of Python
There are so many applications of Python in the real world. But over time we’ve seen that there
are three main applications for Python
• Web Development
• Data Science (including Machine Learning)
• Data Analysis/Visualization
MYSQL
Python needs a MySQL driver to access the MySQL database. The data in a MYSQL
database are stored in database are stored in tables. A table is a collection of related data, and it
consists of columns and rows. Databases are useful for storing information categorically.
MySQL is offered under two different editions: the open-source MySQL Community
Server and the proprietary Enterprise server. MySQL is available via the General Public License
(GPU). MySQL consists of a MySQL server, several utility programs that assist the administration
of the MySQL databases. MySQL Enterprise Server is differentiated by a series of proprietary
extensions which install as server plugins, but otherwise shares the versions numbering system
and is built from the same code base.
MySQL Database
MySQL is developed, marketed and supported by MySQL AB, which is Swedish company.
SQL is a formal programming language. Speed was he developer’s main focus when SQL was
being developed.
• MySQL is related under an open-source license. So, you have nothing to pay to
use it.
• MySQL is a very powerful program in its own right. Its handle a large subset of
the functionality of the most expensive and powerful database packages.
• MySQL works on many operating systems and with many languages including
PHP, PERL, C, C++, JAVA, etc.
10
• MySQL supports large database, up to 50 million rows or more in a table. The
default file size limit for a table is 4GB, but you can increase this (if your operating
system can handle it) to a theoretical limit of 8 million terabytes (TB).
• It is pre-packaged with most Linux distributions.
• It’s quite easy to use: you can interact with a MySQL database using a few simple
statements from the SQL language.
• It’s very fast: MySQL’s developers’ main goal was speed; consequently, the
software was designed from the beginning with speed in mind.
• It’s free via the GNU General Public License.
• MySQL is a database system used on the web
• MySQL is a database system that runs on a server
• MySQL is ideal for both small and large applications
• MySQL is very fast, reliable, and easy to use
• MySQL supports standard SQL
• MySQL compiles on a number of platforms
• MySQL is free to download and use
11
3. System Analysis
3.1 Introduction
System Analysis is a process of collecting and interpreting facts, identifying the problems,
and decomposition of a system into its components. System analysis is conducted for the purpose
of studying a system or its parts in order to identify its objectives. It is a problem-solving technique
that improves the system and ensures that all the components of the system work efficiently to
accomplish their purpose. Analysis specifies What the system should do.
12
from different websites. This will make easy shopping with best deals as well as ecommerce
merchants to know well about their competitors.
13
4. System Design
4.1 Introduction
Systems design is the process of defining elements of a system like modules, architecture,
components and their interfaces and data for a system based on the specified requirements. It is
the process of defining, developing and designing systems which satisfies the specific needs and
requirements of a business or organization. Design consists of three phases such as
• Architectural Design
• Detailed Design
• External Design
Architectural Design
It involves the process of defining a collection of hardware and software components and
their interfaces to establish the framework for the development of a computer system and
specifying the inter connections among the components.
Detailed Design
The process of refining and expanding the preliminary design of a system or components
to the extent that the design is sufficiently complete to begin implementation. Detailed design is
strongly influenced by the Programming Language used to implement the system. But design is
not concerned with syntactic aspect of the level of details inherent in expression, evaluation,
assignment and statement.
External Design
The purpose of an external design document is to communicate how the system will appear
to its users, how it will interface with existing work processes, how it will interface with other
pieces of software, and what kinds of work products are required by/produced by the system. This
includes the reports and display formats.
Thus, the designer has to formulate a number of clear objectives in input design.
14
• There should not be any inconsistency of data in input forms.
• To ensure that the input is acceptable and understood by the user.
15
5. System Development
5.1 Introduction
System development is the process of defining, designing, testing and implementing a new
software application or program. It can include the internal development of customized systems,
the creation of database system or the acquisition of third party developed software. There are
three system development strategies:
Prototyping method
A prototyping is a version the of an information system having the essential feature but not
necessarily all the details of the user interface. The prototype many ultimately become the actual
working system.
• Login Page
• Registration Page
• Product Page
• Price comparison
16
Login Page
The main objective of the Login System is to manage the details of Username and
Password. It manages all the information about Login and Register. So that their valuable
data/information can be stored for a longer period with easy accessing and manipulation of the
same.
Registration Page
The main objective of the Registration Page is to manage the details of Username,
Password, Firstname, Lastname. It manages all the information about register. So that their
valuable data/information can be stored for a longer period with easy accessing and manipulation
of the same.
Product Page
The main objective of the product page is to find the particular product. This page gets the
particular product name from the user. After enter the product name the page will move on to
price comparison site.
Price Comparison
The main objective of the price comparison is to find the particular product on the relevant
website to find the price and calculate the minimum price of the product with the particular
product’s link of the ecommerce website.
17
6. Future Enhancement
“Price Comparison Using Python” contains the details of the particular product on
the relevant website it will compare the prices from different websites it will also auto correct the
product spelling mistake. Whether they are looking to compare flight prices or hotel prices for a
vacation, or they’re simply looking to compare local super market prices to see where they can get
the best deals.
This category of app shows you the product prices from different retailers to show you
where to buy the product affordably. Some price comparison tools require you to scan the barcode
while others allow you to type in the product name to find your product.
18
7.Conclusion
This system is designed to compare the same product in different outlets, across different
brands for that we use login system to manages all the information about Login and Register. So
that their valuable data/information can be stored for a longer period with easy accessing and
manipulation of the same. It shows the price and properties of each product which are given by
the user in detail and calculate the minimum price and also display each product’s link for every
given website.
19
8. Bibliography
References
1. The Complete Reference Python Third Edition-Martin C. Brown
Websites
1. https://youtu.be/mhdExzt7AnU
2. https://youtu.be/vlTbbgb_t2g
4. Python Tutorial For Beginners | Python For Beginners | Free Course | Great Learning
5. https://youtube.com/playlist?list=PLsyeobzWxl7poL9JTVyndKe62ieoN-MZ3
20
9. Annexure
DFD graphically representing the functions, or processes, which capture, manipulate, store,
and distribute data between a system and its environment and between components of a system.
The visual representation makes it a good communication tool between User and System
designer. Structure of DFD allows starting from a board overview and expand it to a hierarchy of
detailed diagrams. DFD has often been used due to the following reasons:
DFD Symbols
There are four basic symbols that are used to represent a data-flow diagram.
Process
A process receives input data and produces output with different content or form.
Processes can be as simple as collecting input data and saving in the database, or it can be complex
as producing a report containing monthly sales of all retail stores in the northwest region.
Notation
• A round rectangle represents a process
• Processes are given IDs for easy referencing
21
Data Flow
A data-flow is a path for data to move from one part of the information system to another.
A data-flow may represent a single data element such the Customer ID or it can represent a set of
data element (or a data structure).
Notation
• Straight lines with incoming arrows are input data flow
• Straight lines with outgoing arrows are output data flows
• Black holes – A processing step may have input flows but no output flows.
• Miracles – A processing step may have output flows but no input flows.
• Grey – A processing step may have outputs that are greater than the sum of its
inputs.
Data Store
A data store or data repository is used in a data-flow diagram to represent a situation when
the system must retain data because one or more processes need to use the stored data in a later
time.
Notation
• Data can be written into the data store, which is depicted by an outgoing arrow
• Data can be read from a data store, which is depicted by an incoming arrow.
• Examples are: Inventory, Accounts receivables, Orders, and Daily Payments.
External Entity
An external entity is a person, department, outside organization, or their information
system that provides data to the system or receives outputs from the system. External entities are
22
components outside of the boundaries of the information systems. They represent how the
information system interacts with the outside world.
Notation
• A customer submitting an order and then receive a bill from the system
• A vendor issue an invoice
23
Flow Diagram
Level: 0
Price Customer
Admin
comparison
Needed Output Required Input
Level: 1
Product
Details
Table name
Comparing
Product Price
24
9.2 Screen Design
Login Page
25
Registration Page
26
Validation Checking
27
Validation Checking
28
Registration Page
29
Successfully Register
30
Invalid Username
31
Validation Checking
32
Invalid Password
33
Login Page
34
Successfully Login
35
Price Comparison Results
36
Price Comparison Results
37
Price Comparison Results
38
Price Comparison Results
39
Price Comparison Results
40
9.3 Source code
Loginpage.py
from tkinter import *
import sqlite3
root = Tk()
width = 640
height = 480
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
x = (screen_width/2) - (width/2)
y = (screen_height/2) - (height/2)
root.resizable(0, 0)
def Database():
conn = sqlite3.connect("db_member.db")
cursor = conn.cursor()
USERNAME = StringVar()
PASSWORD = StringVar()
41
FIRSTNAME = StringVar()
LASTNAME = StringVar()
def LoginForm():
LoginFrame = Frame(root)
LoginFrame.pack(side=TOP, pady=80)
lbl_username.grid(row=1)
lbl_password.grid(row=2)
lbl_result1.grid(row=3, columnspan=2)
username.grid(row=1, column=1)
password.grid(row=2, column=1)
lbl_register.grid(row=0, sticky=W)
lbl_register.bind('<Button-1>', ToggleToRegister)
def RegisterForm():
42
RegisterFrame = Frame(root)
RegisterFrame.pack(side=TOP, pady=40)
lbl_username.grid(row=1)
lbl_password.grid(row=2)
lbl_firstname.grid(row=3)
lbl_lastname.grid(row=4)
lbl_result2.grid(row=5, columnspan=2)
username.grid(row=1, column=1)
password.grid(row=2, column=1)
firstname.grid(row=3, column=1)
lastname.grid(row=4, column=1)
lbl_login.grid(row=0, sticky=W)
43
lbl_login.bind('<Button-1>', ToggleToLogin)
def Exit():
if result == 'yes':
root.destroy()
exit()
def ToggleToLogin(event=None):
RegisterFrame.destroy()
LoginForm()
def ToggleToRegister(event=None):
LoginFrame.destroy()
RegisterForm()
def Register():
Database()
else:
else:
44
conn.commit()
USERNAME.set("")
PASSWORD.set("")
FIRSTNAME.set("")
LASTNAME.set("")
cursor.close()
conn.close()
def Login():
Database()
else:
btn_login=Session.post("http://pricecomparison.py/",data=paylaod).content.decode()
else:
LoginForm()
menubar = Menu(root)
filemenu.add_command(label="Exit", command=Exit)
menubar.add_cascade(label="File", menu=filemenu)
45
root.config(menu=menubar)
if __name__ == '__main__':
root.mainloop()
Price Comparison.py
from bs4 import BeautifulSoup
import requests
import time
flipkart=''
amazon=''
olx=''
def flipkart(name):
try:
global flipkart
flipkart=f'https://www.flipkart.com/search?q={name1}&otracker=search&otracker1=search
&marketplace=FLIPKART&as-show=off&as=off'
res =
requests.get(f'https://www.flipkart.com/search?q={name1}&otracker=search&otracker1=search
&marketplace=FLIPKART&as-show=off&as=off',headers=headers)
print("\nSearching in flipkart....")
46
soup = BeautifulSoup(res.text,'html.parser')
flipkart_name = flipkart_name.upper()
if name.upper() in flipkart_name:
flipkart_name = soup.select('._4rR01T')[0].getText().strip()
print("Flipkart:")
print(flipkart_name)
print(flipkart_price)
print("-----------------------")
else:
print("-----------------------")
flipkart_price='0'
return flipkart_price
except:
print("-----------------------")
flipkart_price= '0'
return flipkart_price
def amazon(name):
try:
global amazon
47
name1 = name.replace(" ","-")
amazon=f'https://www.amazon.in/{name1}/s?k={name2}'
res = requests.get(f'https://www.amazon.in/{name1}/s?k={name2}',headers=headers)
print("\nSearching in amazon:")
soup = BeautifulSoup(res.text,'html.parser')
amazon_page = soup.select('.a-color-base.a-text-normal')
amazon_page_length = int(len(amazon_page))
for i in range(0,amazon_page_length):
name = name.upper()
amazon_name = soup.select('.a-color-base.a-text-normal')[i].getText().strip().upper()
if name in amazon_name[0:20]:
amazon_name = soup.select('.a-color-base.a-text-normal')[i].getText().strip().upper()
amazon_price = soup.select('.a-price-whole')[i].getText().strip().upper()
print("Amazon:")
print(amazon_name)
print("₹"+amazon_price)
print("-----------------------")
break
else:
i+=1
i=int(i)
if i==amazon_page_length:
print("-----------------------")
48
amazon_price = '0'
break
return amazon_price
except:
print("-----------------------")
amazon_price = '0'
return amazon_price
def olx(name):
try:
global olx
olx=f'https://www.olx.in/items/q-{name1}?isSearchCall=true'
res = requests.get(f'https://www.olx.in/items/q-
{name1}?isSearchCall=true',headers=headers)
print("\nSearching in OLX......")
soup = BeautifulSoup(res.text,'html.parser')
olx_name = soup.select('._2tW1I')
olx_page_length = len(olx_name)
for i in range(0,olx_page_length):
olx_name = soup.select('._2tW1I')[i].getText().strip()
name = name.upper()
olx_name = olx_name.upper()
49
if name in olx_name:
olx_price = soup.select('._89yzn')[i].getText().strip()
olx_name = soup.select('._2tW1I')[i].getText().strip()
olx_loc = soup.select('.tjgMj')[i].getText().strip()
try:
except:
label = "OLD"
print("Olx:")
print(label)
print(olx_name)
print(olx_price)
print(olx_loc)
print("-----------------------")
break
else:
i+=1
i=int(i)
if i==olx_page_length:
print("-----------------------")
olx_price = '0'
break
return olx_price
50
except:
print("-----------------------")
olx_price = '0'
return olx_price
def convert(a):
b=a.replace(" ",'')
c=b.replace("INR",'')
d=c.replace(",",'')
f=d.replace("₹",'')
g=int(float(f))
return g
###
name=input("product name:\n")
flipkart_price=flipkart(name)
amazon_price=amazon(name)
olx_price = olx(name)
print("----------------------------------")
if flipkart_price=='0':
flipkart_price = int(flipkart_price)
else:
51
print("\nFLipkart Price:",flipkart_price)
flipkart_price=convert(flipkart_price)
if amazon_price=='0':
amazon_price = int(amazon_price)
else:
amazon_price=convert(amazon_price)
if olx_price =='0':
olx_price = int(olx_price)
else:
print("\nOlx Price:",olx_price)
olx_price=convert(olx_price)
time.sleep(2)
lst = [flipkart_price,amazon_price,olx_price]
#print(lst)
lst2=[]
for j in range(0,len(lst)):
52
if lst[j]>0:
lst2.append(lst[j])
if len(lst2)==0:
else:
min_price=min(lst2)
print("_______________________________")
price = {
f'{amazon_price}':f'{amazon}',
f'{olx_price}':f"{olx}",
f'{flipkart_price}':f'{flipkart}',
if int(key)==min_price:
print("\nUrls:\n")
print("-----------------------------------------------------------------------")
print(amazon)
print(olx)
print(flipkart)
print("------------------------------------------------------------------------")
53