Skip to content
This repository has been archived by the owner on Jan 12, 2021. It is now read-only.

json.decoder.JSONDecodeError #37

Open
rohitjangid96 opened this issue Mar 29, 2019 · 2 comments
Open

json.decoder.JSONDecodeError #37

rohitjangid96 opened this issue Mar 29, 2019 · 2 comments

Comments

@rohitjangid96
Copy link

from servicenow import ServiceNow
from servicenow import Connection

# Connect using default api method (JSON)
conn = Connection.Auth(username='*****', password='*****', instance='cablevision')
inc = ServiceNow.Incident(conn)


inc = inc.fetch_one({'number': 'INC0665393'})

Traceback (most recent call last):
File "C:/Users/rohitjan/PycharmProjects/AutomationScripts/sernow.py", line 10, in
inc = inc.fetch_one({'number': 'INC0665393'})
File "C:\Users\rohitjan\PycharmProjects\AutomationScripts\venv\lib\site-packages\servicenow\Utils.py", line 13, in caching
return f(*args, **kwargs)
File "C:\Users\rohitjan\PycharmProjects\AutomationScripts\venv\lib\site-packages\servicenow\ServiceNow.py", line 29, in fetch_one
response = self.fetch_all(meta, **kwargs)
File "C:\Users\rohitjan\PycharmProjects\AutomationScripts\venv\lib\site-packages\servicenow\Utils.py", line 13, in caching
return f(*args, **kwargs)
File "C:\Users\rohitjan\PycharmProjects\AutomationScripts\venv\lib\site-packages\servicenow\ServiceNow.py", line 21, in fetch_all
return self.format(self.Connection._get(self.table, meta, **kwargs))
File "C:\Users\rohitjan\PycharmProjects\AutomationScripts\venv\lib\site-packages\servicenow\ServiceNow.py", line 54, in format
return self.Connection._format(response)
File "C:\Users\rohitjan\PycharmProjects\AutomationScripts\venv\lib\site-packages\servicenow\Connection.py", line 116, in format
return json.loads(response.text)
File "C:\Users\rohitjan\AppData\Local\Programs\Python\Python37-32\lib\json_init
.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Users\rohitjan\AppData\Local\Programs\Python\Python37-32\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\rohitjan\AppData\Local\Programs\Python\Python37-32\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@nagyem
Copy link

nagyem commented Jun 26, 2020

Did you ever find a solution?

@alignedright
Copy link

alignedright commented Jul 13, 2020

I had a similar issue, fixed by adding api='JSONv2":

For Dublin+ instances, connect using JSONv2
conn = Connection.Auth(username='edsu', password='bele', instance='servicenowsubdomain', api='JSONv2')

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

No branches or pull requests

3 participants