Created
November 9, 2016 02:39
-
-
Save kgourgou/9d9956655027e0bcb881d2f3d5af46a8 to your computer and use it in GitHub Desktop.
For people that are bored of the sensationalism of the media and just want the cold, hard, fact.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A hilary-endorsing script that loads the predictions from the NYT. | |
""" | |
import requests | |
from dateutil.parser import parse | |
# election forecast link | |
url = "https://intf.nyt.com/newsgraphics/2016/11-08-election-forecast/president.json" | |
req = requests.get(url) | |
data = req.json() | |
# load the probabilities | |
probs = data["president"]["current"]["win_prob"] | |
hilary = probs["clintonh"] | |
trump = probs["trumpd"] | |
when_is_this = parse(data["president"]["current"]["timestamp"]) | |
print "As of",when_is_this.hour + 7,":",when_is_this.minute, "PM", | |
if trump>hilary: | |
print ", looks like we are screwed." | |
elif trump<hilary: | |
print ", looks like we are safe." | |
else: | |
print ", things look pretty even from here." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment