Skip to content

Instantly share code, notes, and snippets.

@G10DRAS
Last active June 8, 2018 04:45
Show Gist options
  • Save G10DRAS/c54432063597ed9a2b5df3ba247ccfc9 to your computer and use it in GitHub Desktop.
Save G10DRAS/c54432063597ed9a2b5df3ba247ccfc9 to your computer and use it in GitHub Desktop.
Currency Rate Converter [working]
import urllib2
import json
curr_from = "JPY"
curr_to = "INR"
curr_input = 1
curr_pair = curr_from + "_" + curr_to
api_url = "https://free.currencyconverterapi.com/api/v5/convert?q={0}&compact=ultra".format(curr_pair)
jsonurl = urllib2.urlopen(api_url)
rate_json = json.loads(jsonurl.read())
rate = curr_input * float(rate_json[curr_pair])
print rate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment