Last active
June 8, 2018 04:45
-
-
Save G10DRAS/c54432063597ed9a2b5df3ba247ccfc9 to your computer and use it in GitHub Desktop.
Currency Rate Converter [working]
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
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