Created
September 22, 2017 15:37
-
-
Save sharuzzaman/fef5b9a2be8f415d5a35b84f58d9a2f9 to your computer and use it in GitHub Desktop.
BTC last price
This file contains 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
#!/bin/env python | |
import urllib2 | |
import json | |
opener = urllib2.build_opener() | |
opener.addheaders = [('User-agent', 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0')] | |
rawdata = opener.open('https://cex.io/api/ticker/BTC/USD') | |
data = rawdata.read() | |
items = json.loads(data) | |
print items['last'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment