Skip to content

Commit 622679c

Browse files
author
AdhilUsman
committed
Get Weather Details of a city
1 parent cb448c2 commit 622679c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

scripts/weather.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import requests
2+
from bs4 import BeautifulSoup
3+
4+
city = input("Enter City Name: ")
5+
6+
search = 'weather in ' + city
7+
8+
url = f'https://www.google.com/search?&q={search}'
9+
10+
r = requests.get(url)
11+
12+
s = BeautifulSoup(r.text,"html.parser")
13+
14+
update = s.find("div",class_="BNeawe").text
15+
16+
print(update)
17+

0 commit comments

Comments
 (0)