Advertisement
teslariu

clima

Apr 26th, 2022
799
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. #api = m6ce13bc6d5a965e991adaea8fce8676a
  9.  
  10.  
  11. r = requests.get("https://api.openweathermap.org/data/2.5/weather?lat=-34.61&lon=-58.38&appid=6ce13bc6d5a965e991adaea8fce8676a")
  12. data = r.json()
  13. pprint(data)
  14. print()
  15.  
  16. print("Hora")
  17. print(datetime.fromtimestamp(data['dt']))
  18. print("Salida del Sol")
  19. print(datetime.fromtimestamp(data['sys']['sunrise']))
  20. print("Puesta del Sol")
  21. print(datetime.fromtimestamp(data['sys']['sunset']))
Advertisement
RAW Paste Data Copied
Advertisement