|
|
|
|
44
|
if not m:
|
44
|
if not m:
|
45
|
# wrong query
|
45
|
# wrong query
|
46
|
return params
|
46
|
return params
|
47
|
-
|
|
|
48
|
amount, from_currency, to_currency = m.groups()
|
47
|
amount, from_currency, to_currency = m.groups()
|
49
|
amount = float(amount)
|
48
|
amount = float(amount)
|
50
|
from_currency = name_to_iso4217(from_currency.strip())
|
49
|
from_currency = name_to_iso4217(from_currency.strip())
|
|
|
|
|
64
|
|
63
|
|
65
|
def response(resp):
|
64
|
def response(resp):
|
66
|
"""remove first and last lines to get only json"""
|
65
|
"""remove first and last lines to get only json"""
|
67
|
- json_resp = resp.text[resp.text.find('\n')+1:resp.text.rfind('\n')-2]
|
|
|
|
|
66
|
+ json_resp = resp.text[resp.text.find('\n') + 1:resp.text.rfind('\n') - 2]
|
68
|
results = []
|
67
|
results = []
|
69
|
try:
|
68
|
try:
|
70
|
conversion_rate = float(json.loads(json_resp)['conversion']['converted-amount'])
|
69
|
conversion_rate = float(json.loads(json_resp)['conversion']['converted-amount'])
|