Skip to content

Instantly share code, notes, and snippets.

@gilgamezh
Created July 7, 2017 20:17
Show Gist options
  • Save gilgamezh/f80ffb45acbaa2ebb183304e8f6c19a8 to your computer and use it in GitHub Desktop.
Save gilgamezh/f80ffb45acbaa2ebb183304e8f6c19a8 to your computer and use it in GitHub Desktop.
#!/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