Skip to content

Instantly share code, notes, and snippets.

Created July 6, 2017 20:38
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save RChloe/5dc18d02914289bd06aaa5191931d60c to your computer and use it in GitHub Desktop.
import urllib.request
import urllib.parse
import json
# --------- User Settings ---------
BUCKET_KEY = "cryptoprice"
# ---------------------------------
def get_conditions():
api_conditions_url = "" + "/data/pricemulti?fsyms=ETH,BTC,LTC&tsyms=USD,EUR"
f = urllib.request.urlopen(api_conditions_url)
print("Failed to get conditions")
return False
json_conditions =
return json.loads(json_conditions)
conditions = get_conditions()
if (conditions != False):
payload = urllib.parse.urlencode({'ETH USD':conditions['ETH']['USD'],'BTC USD':conditions['BTC']['USD'],'LTC USD':conditions['LTC']['USD'],'ETH EUR':conditions['ETH']['EUR'],'BTC EUR':conditions['BTC']['EUR'],'LTC EUR':conditions['LTC']['EUR']})
payload = payload.encode('ascii')
url = '' + ACCESS_KEY + '&bucketKey=' + BUCKET_KEY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment