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
Hi,
Trying to run this simple script in virtual environment on MacOS, Python 2.7.16
and I'm getting this error:
what am I doing wrong ? the credentials are valid.