Skip to content

Instantly share code, notes, and snippets.

Created November 12, 2013 03:48
Show Gist options
  • Save anonymous/245e8a507a502fd5b860 to your computer and use it in GitHub Desktop.
Save anonymous/245e8a507a502fd5b860 to your computer and use it in GitHub Desktop.
import urllib.request
import json
import time
filename="data.json"
url = "https://api.bitcoinaverage.com/no-mtgox/ticker/USD"
while(1):
request = urllib.request.Request(url)
response = urllib.request.urlopen(request)
data=json.load(response.read().decode('utf-8'))
fh = open(filename, "w")
json.dump(data, fh)
fh.close()
time.sleep(30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment