Advertisement
teslariu

clima

Oct 2nd, 2021
74
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. r = requests.get('https://api.openweathermap.org/data/2.5/weather?q=Buenos%20Aires&units=metric&lang=es&appid=6ce13bc6d5a965e991adaea8fce8676a')
  9. data = r.json()
  10. pprint(data)
  11.  
  12. print("\n\nFecha y hora del pronĂ³stico:")
  13. print(datetime.fromtimestamp(data['dt']))
  14.  
  15. print("\n\nSalida del Sol")
  16. print(datetime.fromtimestamp(data['sys']['sunrise']))
  17.  
  18. print("\n\nPuesta del Sol:")
  19. print(datetime.fromtimestamp(data['sys']['sunset']))
  20.  
  21.  
  22. r = requests.get('https://api.openweathermap.org/data/2.5/onecall?lat=-34.61&lon=-58.38&units=metric&lang=es&exclude={current, minutely, hourly&appid=6ce13bc6d5a965e991adaea8fce8676a')
  23. data = r.json()
  24. pprint(data)
Advertisement
RAW Paste Data Copied
Advertisement