Closed khurramshafiq07 closed 2 years ago
Same problem, i try to run "c.get_rates('USD')" and it throws the following error
JSONDecodeError requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last) File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/requests/models.py", line 971, in json return complexjson.loads(self.text, kwargs) File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/simplejson/init.py", line 525, in loads return _default_decoder.decode(s) File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) During handling of the above exception, another exception occurred: File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/flask-2/app.py", line 31, in check_if_valid_and_convert rates_from = c.get_rates(from_currency).keys() File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/forex_python/converter.py", line 60, in get_rates rates = self._decode_rates(response, date_str=date_str) File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/forex_python/converter.py", line 40, in _decode_rates decoded_data = response.json() File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/requests/models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) During handling of the above exception, another exception occurred: File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/requests/models.py", line 971, in json return complexjson.loads(self.text, kwargs) File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/simplejson/init.py", line 525, in loads return _default_decoder.decode(s) File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) During handling of the above exception, another exception occurred: File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/flask/app.py", line 2091, in call return self.wsgi_app(environ, start_response) File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/flask/app.py", line 2076, in wsgi_app response = self.handle_exception(e) File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app response = self.full_dispatch_request() File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/flask/app.py", line 1519, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/flask/app.py", line 1517, in full_dispatch_request rv = self.dispatch_request() File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/flask/app.py", line 1503, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/flask-2/app.py", line 36, in check_if_valid_and_convert f"CONVERT FROM: Invalid currency type. Please type with correct format (e.g. 'USD') {from_currency} {c_symbol.get_symbol(from_currency)} {c.get_rates(from_currency).keys()} ") File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/forex_python/converter.py", line 60, in get_rates rates = self._decode_rates(response, date_str=date_str) File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/forex_python/converter.py", line 40, in _decode_rates decoded_data = response.json() File "/home/rodrigo/Springboard/20_Assesment_3_Forex_Converter/venv/lib/python3.8/site-packages/requests/models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Yes, I am getting the same error I would appreciate any help on this issue.
fixed
how?