-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.py
More file actions
51 lines (44 loc) · 1.37 KB
/
test.py
File metadata and controls
51 lines (44 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import os
import sys
import urllib
import urllib2
import json
from datetime import date
from datetime import time
from datetime import datetime
print (sys.version)
thedate = "25/05/2016"
print "La fecha es: " + thedate
#showDate = datetime.strptime(thedate, "%d/%m/%Y").date()
showDate = datetime.strptime('2015-05-24', "%Y-%m-%d").date()
showDate = datetime.strptime('2015-05-24', "%Y-%m-%d").date()
showDate = datetime.strptime('2015-05-24', "%Y-%m-%d").date()
todayDate = datetime.today().date()
mylist = []
mylist.append(showDate)
mylist.append(todayDate)
print mylist[0]
print mylist[1]
if(showDate < todayDate):
print "Pasado"
else:
print "Actual"
jsonUrl = 'http://arenavision.esy.es/json.php?cat=baloncesto'
jsonSrc = urllib2.urlopen(jsonUrl)
datos = json.load(jsonSrc)
eventos = datos['eventos']
last_update = datos['last_update']
for evento in eventos:
showDate = datetime.strptime(evento['fecha'], "%d/%m/%y").date()
todayDate = datetime.today().date()
if(showDate < todayDate):
print evento['fecha'] + " pasado"
color = 'grey'
elif(showDate > todayDate):
print evento['fecha'] + " futuro"
color = 'black'
else:
print evento['fecha'] + " actual"
color = 'skyblue'
title = "[COLOR "+color+"]" + evento['fecha'] + " " + evento['hora'] + "[/COLOR] " + evento['titulo']
print title