Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting No JSON object could be decoded #5

Open
Constantin07 opened this issue Nov 4, 2020 · 1 comment
Open

getting No JSON object could be decoded #5

Constantin07 opened this issue Nov 4, 2020 · 1 comment

Comments

@Constantin07
Copy link

Hi,

Trying to run this simple script in virtual environment on MacOS, Python 2.7.16

#!/usr/bin/env python

import os
from sumologic import Client, Collectors, Search

USENAME = os.environ['SUMOLOGIC_ACCESSID']
PASSWORD = os.environ['SUMOLOGIC_ACCESSKEY']

# Need a client to authenticate to service
client = Client(auth=(USENAME, PASSWORD))

# collector usage
collector = Collectors(client)
for c in collector.get_collectors():
    print('{0}:{1}'.format(c['name'], c['alive']))

and I'm getting this error:

Traceback (most recent call last):
  File "./script.py", line 14, in <module>
    for c in collector.get_collectors():
  File "/Users/user/Documents/SumoLogic/api/.venv/lib/python2.7/site-packages/sumologic/collectors.py", line 41, in get_collectors
    results = request.json()['collectors']
  File "/Users/user/Documents/SumoLogic/api/.venv/lib/python2.7/site-packages/requests/models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
pip freeze
certifi==2020.6.20
chardet==3.0.4
idna==2.10
requests==2.24.0
sumologic==0.1.4
urllib3==1.25.11

what am I doing wrong ?
the credentials are valid.

@sijis
Copy link
Owner

sijis commented Nov 5, 2020

I'll have to check. I haven't touched this code ina while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants