Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import requests
- from datetime import datetime
- from pprint import pprint
- r = requests.get('https://api.openweathermap.org/data/2.5/forecast?q=Buenos%20Aires,AR&cnt=10&units=metric&lang=es&appid=6ce13bc6d5a965e991adaea8fce8676a')
- data = r.json()
- for dia in data['list']:
- for c,v in dia.items():
- if c == 'dt':
- t = datetime.fromtimestamp(dia['dt']).strftime("%d-%m-%y %H:%M:%S")
- dia['dt'] = t
- pprint(data)
Advertisement
Add Comment
Please, Sign In to add comment