Skip to content

Commit 325a78a

Browse files
Merge pull request prathimacode-hub#163 from Komal-99/weather
Weather Notifier Script
2 parents 26732e3 + fe4b6eb commit 325a78a

File tree

5 files changed

+68
-0
lines changed

5 files changed

+68
-0
lines changed

AutomationScripts/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ Automation Scripts is a collection of scripts/projects which helps us in automat
77
- [LaunchMaps](https://github.com/prathimacode-hub/Awesome_Python_Scripts/tree/main/AutomationScripts/LaunchMaps)
88
- [Battery Notification](https://github.com/prathimacode-hub/Awesome_Python_Scripts/tree/main/AutomationScripts/Battery%20Notification)
99
- [Facebook Messenger Automation](https://github.com/prathimacode-hub/Awesome_Python_Scripts/tree/main/AutomationScripts/Facebook%20Messenger%20Automation)
10+
- [Weather Notifier](https://github.com/Komal-99/Awesome_Python_Scripts/tree/weather/AutomationScripts/Weather%20Notifier)
66.2 KB
Loading
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Weather temperature detection
2+
3+
- It is python script to get weather notification on your desktop.
4+
- After every 20 second the notification comes.
5+
## workflow
6+
* It works on bs4 and times library of python to automate google search when the program is runned.
7+
* Their are various features used to scrape data from web and then put in notified format.
8+
### Output Screenshot
9+
10+
11+
12+
### Getting Started
13+
14+
1. Install all Python dependencies.
15+
16+
```
17+
pip install -r requirements.txt
18+
```
19+
20+
2. Navigate into `AutomationScripts`.
21+
22+
```
23+
cd AutomationScripts
24+
```
25+
26+
3. Launch the script for compilation of program
27+
28+
```
29+
python weather.py
30+
```
31+
4. Output Screenshot.
32+
33+
<img src="https://github.com/Komal-99/Awesome_Python_Scripts/blob/weather/AutomationScripts/Weather%20Notifier/Images/Screenshot.jpg">
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
time
2+
requests
3+
json
4+
bs4
5+
win10toast
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# import Libraries
2+
import time
3+
import requests
4+
import json
5+
from bs4 import BeautifulSoup
6+
from win10toast import ToastNotifier
7+
# Defination of function to fetch the data
8+
def update():
9+
# Take Inout From User
10+
city=input("enter name of the city")
11+
# google search done by program itself similar to web scraping
12+
search="weather in"+city
13+
url=f"https://www.google.com/search?q={search}"
14+
r=requests.get(url)
15+
print(r)
16+
s= BeautifulSoup(r.text,"html.parser")
17+
print(s)
18+
update=s.find("div",class_="BNeawe").text
19+
print(update)
20+
# format to print the Notification
21+
text= f'Temperature in {city} in degree celsius is \n{update}'
22+
while True:
23+
toast=ToastNotifier()
24+
# time duration for getting notified
25+
toast.show_toast("weather Update",text, duration=20)
26+
time.sleep(10)
27+
# calling update function
28+
update()
29+

0 commit comments

Comments
 (0)