Skip to content

Commit

Permalink
Fixed evonove#4: Python 3 error with updating_rates management command
Browse files Browse the repository at this point in the history
  • Loading branch information
synasius committed Jan 12, 2014
1 parent ea8676b commit 61351f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion djmoney_rates/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def __init__(self):
def get_rates(self):
try:
logger.debug("Connecting to url %s" % self.url)
data = urlopen(self.url).read()
data = urlopen(self.url).read().decode("utf-8")
return json.loads(data)['rates']

except Exception as e:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ def get_rates(self):


class TestOpenExchangeBackend(BaseTest):
test_data_1 = """{"disclaimer": "Exchange rates provided by [...]",
test_data_1 = b"""{"disclaimer": "Exchange rates provided by [...]",
"license": "Data collected and blended [...]", "timestamp": 1319730758, "base": "USD",
"rates": {"AED": 3.672626, "AFN": 48.3775, "ALL": 110.223333, "AMD": 409.604993,
"YER": 215.035559, "ZAR": 8.416205, "ZMK": 4954.411262, "ZWL": 322.355011}}"""

test_data_2 = """{"disclaimer": "Exchange rates provided by [...]",
test_data_2 = b"""{"disclaimer": "Exchange rates provided by [...]",
"license": "Data collected and blended [...]", "timestamp": 1319730758, "base": "USD",
"rates": {"AED": 4.672626, "AFN": 48.3775, "ALL": 110.223333, "AMD": 409.604993,
"YER": 215.035559, "ZAR": 8.416205, "ZMK": 4954.411262, "ZWL": 322.355011}}"""
Expand Down

0 comments on commit 61351f0

Please sign in to comment.