Sep-13-2017, 12:25 AM
Hey community,
currently I am programming a programing which is using the python Bittrex-API wrapper.
I ran into a problem which I am not able to resolve at the moment so I am asking for some help.
I am receiving a current market json file and a pretty confusing error. As you can see having a look at
the ouput I first print out the receiving data from the API wrapper but JSON is complaingin as you can see at
the bottom. I dunno how to fix this :(
Sourcecode:
Output:
currently I am programming a programing which is using the python Bittrex-API wrapper.
I ran into a problem which I am not able to resolve at the moment so I am asking for some help.
I am receiving a current market json file and a pretty confusing error. As you can see having a look at
the ouput I first print out the receiving data from the API wrapper but JSON is complaingin as you can see at
the bottom. I dunno how to fix this :(
Sourcecode:
from bittrex import Bittrex import json my_bittrex = Bittrex(None, None) buffer = str(my_bittrex.get_ticker("USDT-BTC")).replace("'",'"') print(buffer) parsed_json = json.loads(buffer) print(parsed_json["Last"])Just in case you are wondering about the replace function: I used it because the API wrapper returns a json string using single quotes and JSON complained about it. It said I have to use double quotes so I replaced them.
Output:
Output:{"result": {"Last": 4159.99999999, "Ask": 4159.99999999, "Bid": 4133.0}, "success": True, "message": ""}
Traceback (most recent call last):
File "/home/pi/C9Workspace/Python/bittrex_test.py", line 8, in <module>
parsed_json = json.loads(buffer)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 85 (char 84)