Skip to content

no json object in response #3

@jeremy-rutman

Description

@jeremy-rutman

Hi , I blv. I'm using the api correctly but hit a 'JSONDecodeError', maybe you have changed things around since the api was published?

import Bit2cClient

url='https://www.bit2c.co.il/'
key='xxx'
secret='yyy'
client=Bit2cClient.Bit2cClient(Url=url,Key=key,Secret=secret)
t=client.GetTicker()
print('last {} highest buy order {} lowest sell {} vol24h {} av24h {}'.format(t.ll(),t.h,t.l,t.a,t.av))

jeremy@jr:~/projects/algotrade/Bit2c.co.il.API.Python$ python bit2c_python2.py
using url https://www.bit2c.co.il/Exchanges/0/Ticker.json
response=b'\n<!--[if lt IE 7]> ...\n'
Traceback (most recent call last):
File "/home/jeremy/projects/algotrade/Bit2c.co.il.API.Python/api_amalgamate.py", line 29, in
client.GetTicker()
File "/home/jeremy/projects/algotrade/Bit2c.co.il.API.Python/Bit2cClient.py", line 95, in GetTicker
_json = json.loads(response.decode("utf-8"))
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 1 (char 0)

(I added some printouts in the GetTicker func for debug)

And if I try a 'get' I hit a 503 error (using requests.get)
r = requests.get(url,headers=random_headers())
<Response [503]>
b'\n...Checking your browser before accessing bit2c.co.il.\n'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions