Crypto-toolbox / bitex

Crypto-currency Exchange API Framework
MIT License
483 stars 134 forks source link

BTER API crashing the interface #130

Closed bebosudo closed 6 years ago

bebosudo commented 6 years ago

At this moment, a query to any endpoint of the BTER API returns a response which is a bunch of dots: http://data.bter.com/api/1/pairs

>>> from bitex import Bter
>>> Bter()
/home/bebo/Documents/projects/bitex/bitex/api/base.py:54: IncompleteCredentialsWarning: Incomplete Credentials were given - authentication may not work!
  IncompleteCredentialsWarning)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    Bter()
  File "/home/bebo/Documents/projects/bitex/bitex/interface/bter.py", line 19, in __init__
    super(Bter, self).__init__('Bter', BterREST(**api_kwargs))
  File "/home/bebo/Documents/projects/bitex/bitex/interface/rest.py", line 21, in __init__
    super(RESTInterface, self).__init__(name=name, rest_api=rest_api)
  File "/home/bebo/Documents/projects/bitex/bitex/interface/base.py", line 27, in __init__
    self._supported_pairs = self._get_supported_pairs()
  File "/home/bebo/Documents/projects/bitex/bitex/interface/bter.py", line 23, in _get_supported_pairs
    return self.request('GET', 'pairs').json()
  File "/home/bebo/.venvs/bitex_dev/lib/python3.6/site-packages/requests/models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.6/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 1 (char 0)

Should we catch this behavior, in order to avoid make the interface crash?

deepbrook commented 6 years ago

Hm. No. This appears to be an exchange-side bug. I can't access their API docs either (shows a blank page), so fixing this isn't possible atm.

But for future reference, as a rule of thumb: If you don't know why an exception happens, don't catch it. Otherwise we might have some really odd behaviour later on because we catch something that we shouldn't.

Good reporting tho! Let's leave this open so we can keep tracking this.

deepbrook commented 6 years ago

I have remove bter as their documentation is still not back online, and their support isn't responding. I've decided to drop support for it.