Advertisement
teslariu

clima

Aug 20th, 2022
994
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. import requests
  5. from datetime import datetime
  6. from pprint import pprint
  7.  
  8. """Pronostico actual
  9. url = "https://api.openweathermap.org/data/2.5/weather?lat=-34.61&lon=-58.38&units=metric&lang=es&appid=6ce13bc6d5a965e991adaea8fce8676a"
  10.  
  11. r = requests.get(url)
  12. datos = r.json()
  13.  
  14. pprint(datos)
  15.  
  16. print("\nHora del pronóstico:")
  17. print(datetime.fromtimestamp(datos['dt']))
  18.  
  19. print("\nSalida del Sol:")
  20. print(datetime.fromtimestamp(datos['sys']['sunrise']))
  21.  
  22. print("\nPuesta del Sol:")
  23. print(datetime.fromtimestamp(datos['sys']['sunset']))
  24. """
  25.  
  26.  
  27.  
  28. url="https://api.openweathermap.org/data/2.5/forecast?lat=-34.61&lon=-58.38&units=metric&lang=es&appid=6ce13bc6d5a965e991adaea8fce8676a"
  29.  
  30. r = requests.get(url)
  31. datos = r.json()
  32.  
  33. pprint(datos)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement