Crypto-toolbox/bitex

Problem with Cryptopia ticker()

iuvbio opened this issue · 2 comments

Hi, I get a JSONDecodeError when I call the ticker() method of the Cryptopia interface:

Traceback (most recent call last):
  File "/home/usr/bin/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2881, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-10-70bd93a4a3df>", line 1, in <module>
    cryp["Client"].ticker("DOGE_LTC")
  File "/home/usr/bin/anaconda3/lib/python3.6/site-packages/bitex/utils.py", line 64, in wrapped
    return func(self, pair, *remaining_args, **kwargs)
  File "/home/usr/bin/anaconda3/lib/python3.6/site-packages/bitex/utils.py", line 88, in wrapper
    response = function(*args, **kwargs)
  File "/home/usr/bin/anaconda3/lib/python3.6/site-packages/bitex/interface/cryptopia.py", line 44, in ticker
    return self.request('GET', 'GetMarket/' + pair, params=kwargs)
  File "/home/usr/bin/anaconda3/lib/python3.6/site-packages/bitex/interface/cryptopia.py", line 34, in request
    **req_kwargs)
  File "/home/usr/bin/anaconda3/lib/python3.6/site-packages/bitex/interface/base.py", line 86, in request
    return self.REST.private_query(verb, endpoint, **req_kwargs)
  File "/home/usr/bin/anaconda3/lib/python3.6/site-packages/bitex/api/REST/rest.py", line 102, in private_query
    return self._query(method_verb, **request_kwargs)
  File "/home/usr/bin/anaconda3/lib/python3.6/site-packages/bitex/api/REST/cryptopia.py", line 47, in _query
    resp.json()
  File "/home/usr/bin/anaconda3/lib/python3.6/site-packages/requests/models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "/home/usr/bin/anaconda3/lib/python3.6/site-packages/simplejson/__init__.py", line 518, in loads
    return _default_decoder.decode(s)
  File "/home/usr/bin/anaconda3/lib/python3.6/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/home/usr/bin/anaconda3/lib/python3.6/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 4 (char 3)

I think it's because the BOM Header that is mentioned in the docstring of the CryptopiaREST _query is not removed correctly.

In the dev branch I fixed the cryptopia API, see PR here: #182

Above PR was merged on dev!