JSONDecodeError: Expecting value

by Patryk100   Last Updated September 11, 2019 19:26 PM - source

I am trying to make a call to get the json file using requests and it raises an error saying expecting value.... i think it has to due with the json that gets loaded isnt in utf-8

url_get = 'http://ludwig.corp.podiumdata.com:/qdc/entity/v1/getEntities?type=EXTERNAL&count=2&sortAttr=name&sortDir=ASC'
session = requests.Session()
r = session.get(url_cookie, auth=(username,password), verify=False)
print('--------------------- 1. status_code ----------------------------------')
print(r.status_code)
print('--------------------- 1. headers ----------------------------------')
print(r.headers)
print('--------------------- 1. content ----------------------------------')
data = json.loads(url_get)
print(data)
print('--------------------- 1. cookies ----------------------------------')
print(session.cookies, r.cookies)
print('--------------------- 1. cookies get_dict ----------------------------------')
print(session.cookies.get_dict())
print("7")
Traceback (most recent call last):

  File "<ipython-input-35-71b19df0c4cd>", line 67, in <module>
    data = json.loads(url_get)

  File "//anaconda3/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)

  File "//anaconda3/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())

  File "//anaconda3/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None

JSONDecodeError: Expecting value


Related Questions


Post request won't send

Updated June 03, 2019 14:26 PM



Trying to get data from a API

Updated May 02, 2019 02:26 AM