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

.fetch_one fails with JSONDecodeError("Expecting value", s, err.value) Python 3.5 #32

Open
shadycuz opened this issue Oct 23, 2016 · 8 comments

Comments

@shadycuz
Copy link

raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

group = grp.fetch_one({'name': 'XXXXXXX'})
print(group)

@ajayreddy28390
Copy link

shadycuz,

Did you fix above error?

@shadycuz
Copy link
Author

No but I belive my problem was not having the correct service now API roles.

@shadycuz
Copy link
Author

Or some other credential error.

@ajayreddy28390
Copy link

I dont see as credential issue, as conn is successful.Might be API roles,not sure.
Will see, if anyone else confirms same

inc = ServiceNow.Incident(conn)
#inc = inc.fetch_one({'number': 'INC4578541'})
print (inc)

<servicenow.ServiceNow.Incident object at 0x000001E401FEA8D0>
inc = inc.fetch_one({'number': 'INC4578541'})

Only fetch_one issuing JSONDecodeError
C:\Program Files\Anaconda3\lib\json\decoder.py in raw_decode(self, s, idx)
355 obj, end = self.scan_once(s, idx)
356 except StopIteration as err:
--> 357 raise JSONDecodeError("Expecting value", s, err.value) from None
358 return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@wgrcunha wgrcunha self-assigned this Aug 21, 2017
@amathur347
Copy link

I am getting the same error. Did anyone get a solution? i

@kesavagithub
Copy link

kesavagithub commented Jan 13, 2019

**I am getting the same error. @wgrcunha Please advise.
Error:
**=====================================
Traceback (most recent call last):
File "/var/tmp/sxuevy/snowpoc/getIncDetails.py", line 19, in
inci = inc.fetch_one({'number':'INC637935'})
File "/export/apps/citools/python/python-3.6.1/lib/python3.6/site-packages/servicenow/Utils.py", line 13, in caching
return f(*args, **kwargs)
File "/export/apps/citools/python/python-3.6.1/lib/python3.6/site-packages/servicenow/ServiceNow.py", line 29, in fetch_one
response = self.fetch_all(meta, **kwargs)
File "/export/apps/citools/python/python-3.6.1/lib/python3.6/site-packages/servicenow/Utils.py", line 13, in caching
return f(*args, **kwargs)
File "/export/apps/citools/python/python-3.6.1/lib/python3.6/site-packages/servicenow/ServiceNow.py", line 21, in fetch_all
return self.format(self.Connection._get(self.table, meta, kwargs))
File "/export/apps/citools/python/python-3.6.1/lib/python3.6/site-packages/servicenow/ServiceNow.py", line 54, in format
return self.Connection._format(response)
File "/export/apps/citools/python/python-3.6.1/lib/python3.6/site-packages/servicenow/Connection.py", line 116, in _format
return json.loads(response.text)
File "/export/apps/citools/python/python-3.6.1/lib/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/export/apps/citools/python/python-3.6.1/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/export/apps/citools/python/python-3.6.1/lib/python3.6/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)
===================================

@KCMiller1111
Copy link

It is not likely due to a connection as I'm getting the same error, and I'm opening it from my hard drive. My file is JSON formatted, so while it fails to load, a similar json file in the same location loads fine. I keep culling the file down to see if something in the file is causing a formatting error that makes it think there is a missing value, but no luck yet. When I recently did a straight json.load with the other file that does load, I got a warning: "InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised." Since my hard drive is shared with a OneDrive, I'm wondering if it's related to Office 365 and OneDrive since it has an external connection maybe a security patch just added to Office 365?

@Gloix
Copy link

Gloix commented Jun 10, 2019

For me the error was that I'm using a Kingston instance, and Dublin+ instances should use the JSONv2 api as stated in the readme file.

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

7 participants