I know it's been heavily documented and I've tried to place the .read().decode('utf-8')
everywhere I think it should go but I'm still missing something and I'm not sure where else to turn. I've got a script that works fine in Python 2.7 to scrape ESRI REST URL's for data by fetching the object ID's. However, it does not seem to be cooperating in Python 3. It continuously fails on line 29 (see below). Any help would be GREATLY appreciated.
version = json.loads(webresp.decode('utf-8'))['currentVersion']
I'm always getting this error consistently:
Traceback (most recent call last):
File "<pyshell#20>", line 1, in <module>
main(url, jsonfilelocation, jsonfilename)
File "\\SERVER\Projects\Python\TOUCH\esrirestjson.py", line 73, in main
oids = ESRIJSON().getobjrange(webconn, path)
File "\\SERVER\Projects\Python\TOUCH\esrirestjson.py", line 29, in getobjrange
version = json.loads(webresp.decode('utf-8'))['currentVersion']
File "C:\ArcGISPro\bin\Python\envs\arcgispro-py3\lib\json\__init__.py", line 312, in loads
s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'