Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import requests
  2. from bs4 import BeautifulSoup
  3.  
  4. url = "https://yandex.ru/pogoda/"
  5. city = "moscow"
  6. response = requests.get(url + city)
  7.  
  8. html = BeautifulSoup(response.content, "lxml")
  9.  
  10. def temp():
  11. return html.find("span", {"class": "temp__value"}).text
  12.  
  13. def wind_speed():
  14. return html.find("span", {"class": "wind-speed"}).text
  15.  
  16. def pressure():
  17. return html.find("dl", {"class": "fact__pressure"}).dd.text
  18.  
  19. def humidity():
  20. return html.find("dl", {"class": "fact__humidity"}).dd.text
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement