Skip to content

Commit 25481e3

Browse files
Merge pull request prathimacode-hub#167 from Aditya8821/main
Real-Time Bitcoin Rate
2 parents 6986b7d + 1937242 commit 25481e3

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed
Loading
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## Description:
2+
[**Here**](https://github.com/Aditya8821/Awesome_Python_Scripts/blob/main/WebScrapingScripts/Real-Time%20Bitcoin%20Rate/Bitcoin%20Rate.py) is Python Script which checks the Real-Time Bitcoin rates in INR.
3+
4+
- **BeautifulSoup:**
5+
BeautifulSoup is a python library for pulling data out of HTML and XML files
6+
7+
- **requests:**
8+
requests module allows you to send HTTP requests and returns a response object with all the response
9+
10+
## **Real-Time Use & Purpose:**
11+
In this project you’ll learn about HTTP requests and how to send them using the requests package and will also learn how to extract required data from HTML pages using some simple functions of beautifulsoup module.
12+
As we all know very well that bitcoin price is a fickle thing. You never really know where it’s going to be at the end of the day. So, instead of constantly checking various sites for the latest updates, let’s make a Python script to do the work for you.
13+
14+
## Procedure to follow:
15+
- from bs4 import BeautifulSoup
16+
- import requests
17+
- pass page text as argument in BeautifulSoup and parse it.
18+
- pass required class name as argument in soup.find() function.
19+
- print the output in terms of INR
20+
## Sample Output:
21+
<p align="center"><img src="https://github.com/Aditya8821/Awesome_Python_Scripts/blob/main/WebScrapingScripts/Real-Time%20Bitcoin%20Rate/Images/Demo%20Output.png"></p>
22+
23+
For any queries please contact?
24+
- [**LinkedIn**](https://www.linkedin.com/in/aditya-trivedi-032090164/)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# BeautifulSoup is a python library for pulling data out of HTML and XML files
2+
from bs4 import BeautifulSoup as BS
3+
# requests module allows you to send HTTP requests and returns a Response Object with all the response​.
4+
import requests
5+
def get_price(url):
6+
data=requests.get(url) # Accessing all required data from url site and store in data.
7+
soup=BS(data.text,"html.parser") # It takes text of page as argument and then parse it with html.parser
8+
ans=soup.find("div",class_="BNeawe iBp4i AP7Wnd").text # here the class name is passed as argument to find out that particular info in html text
9+
return ans
10+
url="https://www.google.com/search?q=bitcoin+price"
11+
ans=get_price(url)
12+
print("1 Bitcoin = ",ans)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Python= https://www.python.org/
2+
BeautifulSoup= https://pypi.org/project/beautifulsoup4/
3+
requests= https://pypi.org/project/requests/

0 commit comments

Comments
 (0)