Virgil Dupras avatar Virgil Dupras committed 3c3d439

Added LVL fetching

Comments (0)

Files changed (3)

-4401ac7427ddb04a01cd6ea4a9be0e25af2a71f0 hscommon
+98b95abd14944000cf8712cbf0e5ea425e60b43a hscommon
 from datetime import date
 import threading
 
-from hsutil.path import Path
-from hsutil.testcase import TestCase as TestCaseBase
+from hscommon.path import Path
+from hscommon.testcase import TestCase as TestCaseBase
 
 from .db import RatesDB
 

fetch_yahoo_rates.py

 
 import time
 from datetime import date
-from urllib.parse import urlencode
 from urllib.request import urlopen
 
 from currency_server.db import RatesDB
 
-CURRENCIES_TO_FETCH = ['BHD', 'EGP', 'UAH', 'LTL', 'BBD']
+CURRENCIES_TO_FETCH = ['BHD', 'EGP', 'UAH', 'LTL', 'BBD', 'LVL']
 
 # Open the db
 db = RatesDB()
     # the result of this request is a single CSV line like this:
     # "CADBHD=X",0.3173,"11/7/2008","5:11pm",N/A,N/A,N/A,N/A,N/A 
     response = urlopen('http://download.finance.yahoo.com/d/quotes.csv?s=%sCAD=X&f=sl1d1t1c1ohgv&e=.csv' % currency)
-    content = response.read()
+    content = response.read().decode('latin-1')
     rate = float(content.split(',')[1])
     db.set_CAD_value(date.today(), currency, rate)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.