Skip to content
Prev Previous commit
Next Next commit
Update and rename AutomationScripts/Weather/weather.py to AutomationS…
…cripts/Weather Notifier/weather.py
  • Loading branch information
Komal-99 authored Jun 12, 2021
commit ae62697e11d7b86ea35cd5cade5e6a4f2b8375f0
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@

# import Libraries
import time
import requests
import json
from bs4 import BeautifulSoup
from win10toast import ToastNotifier
# Defination of function to fetch the data
def update():
# Take Inout From User
city=input("enter name of the city")
# google search done by program itself similar to web scraping
search="weather in"+city
url=f"https://www.google.com/search?q={search}"
r=requests.get(url)
Expand All @@ -13,11 +18,14 @@ def update():
print(s)
update=s.find("div",class_="BNeawe").text
print(update)
# format to print the Notification
text= f'Temperature in {city} in degree celsius is \n{update}'
while True:
toast=ToastNotifier()
# time duration for getting notified
toast.show_toast("weather Update",text, duration=20)
time.sleep(10)
# calling update function
update()