Created
July 7, 2017 20:17
-
-
Save gilgamezh/f80ffb45acbaa2ebb183304e8f6c19a8 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/fades | |
import json | |
import requests # fades | |
import os | |
DOLAR = "USD" | |
LIBRA = "GBP" | |
EURO = "EUR" | |
def show_and_set_currency(currency_type): | |
url = "http://www.google.com/finance/info?q=CURRENCY:{}ARS".format(currency_type) | |
req = requests.get(url) | |
vals = json.loads(req.content.decode('utf8')[4:]) | |
current = vals[0]['l'] | |
print("{}: {}".format(currency_type, current)) | |
os.environ[currency_type] = current | |
show_and_set_currency(DOLAR) | |
show_and_set_currency(EURO) | |
show_and_set_currency(LIBRA) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment