Hello... I am trying to grab some JSON text that is on a webpage via a WordPress Api output. There is nothing on this page except the JSON string.
If I go to CMD prompt and navigate to my Python folder I can confirm I have python and PIP
C:\Python310>py --version
Python 3.10.6
C:\Python310>py -m pip --version
pip 22.2.1 from C:\Python310\lib\site-packages\pip (python 3.10)
import arcpy
import requests
import json
import uuid
from urllib.request import urlopen
import urllib
import requests
url = "https://somewebsite/"
response = urlopen(url)
data_json = json.loads(response.read)
print (data_json)
I am trying to above code but keep getting this error:
Traceback (most recent call last):
File "C:\Users\t\Desktop\JSONSamples\readJson.py", line 7, in <module>
from urllib.request import urlopen
ImportError: No module named request
Any thoughts? Do I need to install something additional to Python? Any help would be much appreciated.