rozzac90 / pinnacle

Python Wrapper for Pinnacle Sports API
MIT License
52 stars 26 forks source link

"No json object could be decoded" #16

Closed magiclevinho closed 5 years ago

magiclevinho commented 5 years ago

I have a fresh install of Pycharm and Python 2.7.15 and Pinnacle Python API. When I try the following command: api.market_data.get_fixtures(29) I get a response: "No json object could be decoded"

Additionally I get this:

Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.1\helpers\pydev\pydevd.py", line 1664, in <module> main() File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.1\helpers\pydev\pydevd.py", line 1658, in main globals = debugger.run(setup['file'], None, None, is_module) File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.1\helpers\pydev\pydevd.py", line 1068, in run pydev_imports.execfile(file, globals, locals) # execute the script File "C:/Users/Administrator/.PyCharmCE2018.2/config/scratches/scratch.py", line 6, in <module> soccer_events = api.market_data.get_fixtures(29) File "C:\Python27\lib\site-packages\pinnacle\endpoints\marketdata.py", line 27, in get_fixtures response.json(), resources.FixtureDetails, date_time_sent, datetime.datetime.utcnow() File "C:\Python27\lib\site-packages\requests\models.py", line 866, in json return complexjson.loads(self.text, **kwargs) File "C:\Python27\lib\site-packages\simplejson\__init__.py", line 518, in loads return _default_decoder.decode(s) File "C:\Python27\lib\site-packages\simplejson\decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "C:\Python27\lib\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 2 column 1 (char 2)

If I delete simpleJSON package, I get:


Traceback (most recent call last):
  File "C:/Users/Administrator/.PyCharmCE2018.2/config/scratches/scratch.py", line 6, in <module>
    soccer_events = api.market_data.get_fixtures(29)
  File "C:\Python27\lib\site-packages\pinnacle\endpoints\marketdata.py", line 27, in get_fixtures
    response.json(), resources.FixtureDetails, date_time_sent, datetime.datetime.utcnow()
  File "C:\Python27\lib\site-packages\requests\models.py", line 866, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Python27\lib\json\__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "C:\Python27\lib\json\decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

What could be the problem?

magiclevinho commented 5 years ago

OK, I got it, the problem is I m using an UK Remote Desktop Connection, and the pinnacle blocked the UK IP addresses.