<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: URLLib.Request Errors in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1200259#M65236</link>
    <description>&lt;P&gt;this might help:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;        fsURL = "http://yourwebsite.com"
        payload3 = {'updates': updateAttr, 'f': 'json','token' : aToken}
        r3 = requests.get(fsURL, params=payload3, proxies=proxies)
        print(r3.text)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;just ignore the payload if you dont need to pass any parameters, same goes for the proxy&lt;/P&gt;&lt;P&gt;forgot to say the above just uses requests&lt;/P&gt;&lt;P&gt;Stu&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Aug 2022 06:28:12 GMT</pubDate>
    <dc:creator>StuartMoore</dc:creator>
    <dc:date>2022-08-08T06:28:12Z</dc:date>
    <item>
      <title>URLLib.Request Errors</title>
      <link>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1199916#M65221</link>
      <description>&lt;P&gt;Hello... I am trying to grab some JSON text that is on a webpage via a WordPress Api output.&amp;nbsp; There is nothing on this page except the JSON string.&lt;/P&gt;&lt;P&gt;If I go to CMD prompt and navigate to my Python folder I can confirm I have python and PIP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;C:\Python310&amp;gt;py --version
Python 3.10.6

C:\Python310&amp;gt;py -m pip --version
pip 22.2.1 from C:\Python310\lib\site-packages\pip (python 3.10)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to above code but keep getting this error:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#FF0000"&gt;Traceback (most recent call last):&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#FF0000"&gt;File "C:\Users\t\Desktop\JSONSamples\readJson.py", line 7, in &amp;lt;module&amp;gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#FF0000"&gt;from urllib.request import urlopen&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#FF0000"&gt;ImportError: No module named request&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Any thoughts?&amp;nbsp; Do I need to install something additional to Python?&amp;nbsp; Any help would be much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 16:36:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1199916#M65221</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2022-08-05T16:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: URLLib.Request Errors</title>
      <link>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1199936#M65222</link>
      <description>&lt;P&gt;pip is the mechanism used to get packages, you should check if you have urllib3 installed by opening the python terminal at your environment (like you did) and doing pip list.&amp;nbsp; urllib is part of the standard python library install...&lt;/P&gt;&lt;P&gt;if its not listed, then you can pip install urllib3&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 17:03:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1199936#M65222</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-08-05T17:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: URLLib.Request Errors</title>
      <link>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1199944#M65224</link>
      <description>&lt;P&gt;Maybe a firewall issue on my side?&amp;nbsp; Can I download it and install locally?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try at this location&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jaykapalczynski_0-1659719305473.png" style="width: 969px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/47927i54D0CA1CF52B15E2/image-dimensions/969x126?v=v2" width="969" height="126" role="button" title="jaykapalczynski_0-1659719305473.png" alt="jaykapalczynski_0-1659719305473.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Tryin to install urllib3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jaykapalczynski_1-1659719741525.png" style="width: 785px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/47928i2E0388ABC682AA46/image-dimensions/785x514?v=v2" width="785" height="514" role="button" title="jaykapalczynski_1-1659719741525.png" alt="jaykapalczynski_1-1659719741525.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can get their via web browser&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jaykapalczynski_2-1659719925131.png" style="width: 695px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/47929iAA91E40F2848970D/image-dimensions/695x481?v=v2" width="695" height="481" role="button" title="jaykapalczynski_2-1659719925131.png" alt="jaykapalczynski_2-1659719925131.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 17:19:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1199944#M65224</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2022-08-05T17:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: URLLib.Request Errors</title>
      <link>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1199969#M65225</link>
      <description>&lt;P&gt;Note that this is not the python environment that is installed for Pro. Is your IDE pointing to this python install, or Pro's default environment?&lt;/P&gt;&lt;P&gt;If you look at the start menu folder under arcgis, you should see a Python Command Prompt. Starting that should open a cmd terminal with the active Pro, conda environment.&amp;nbsp; pip list should work there to list all installed packages.&lt;/P&gt;&lt;P&gt;it will look something like: (assessors-env) C:\Program Files\ArcGIS\Pro\bin\Python\envs\assessors-env&amp;gt;&lt;/P&gt;&lt;P&gt;I also get different results using the full python instead of py.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 17:55:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1199969#M65225</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-08-05T17:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: URLLib.Request Errors</title>
      <link>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1200034#M65226</link>
      <description>&lt;P&gt;OK I was able to go into the terminal under GIS and do&amp;nbsp; PIP LIST&lt;/P&gt;&lt;P&gt;Then went to install urllib3 and says that its already satisfied&lt;/P&gt;&lt;P&gt;Let me step back a bit I am running this little snip of code from a file with .py extension through the IDLE interface.&amp;nbsp; I am not running this via ArcGIS Pro.&amp;nbsp; I want to be able to put this .py file on the network and write a .bat file to run in task scheduler.&amp;nbsp; I could be going about this the wrong way ...&lt;/P&gt;&lt;P&gt;It says below that the requirement is already satisfied but when I run through IDLE it give me that error.&amp;nbsp; This is a learning curve and I thank you for your patience and input.&amp;nbsp; Cheers&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;So maybe as you stated I need to make sure the IDLE interface is pointed to ArcGIS Pro or the correct python install as there is still older versions on this computer - not sure how to check or do that.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jaykapalczynski_0-1659729138682.png" style="width: 730px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/47950i7141CBA475298E62/image-dimensions/730x409?v=v2" width="730" height="409" role="button" title="jaykapalczynski_0-1659729138682.png" alt="jaykapalczynski_0-1659729138682.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 20:00:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1200034#M65226</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2022-08-05T20:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: URLLib.Request Errors</title>
      <link>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1200051#M65227</link>
      <description>&lt;P&gt;sweet!&amp;nbsp; The system python might be different than the Pro's python.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;I want to be able to put this .py file on the network and write a .bat file to run in task scheduler.&amp;nbsp; I could be going about this the wrong way ...&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;You can designate the specific python.exe in Task scheduler so you can skip the bat file step. In the actions settings: paste the path to the Pro env and the path to your script like this:&lt;/P&gt;&lt;P&gt;C\:Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe 'path to your script'&lt;/P&gt;&lt;P&gt;and it will parse the path to your script as an argument, which is ok.&amp;nbsp; It will start your script using Pro's python environment and python interpreter.&lt;/P&gt;&lt;P&gt;... you can have that python.exe path and path to your script in the bat file in the same format and it should tell it to start that interpreter and run this script. Either way, I think you need to tell it which python.exe to use.&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;As for setting the interpreter/ env in IDLE, when you open it, it should list the env/ interpreter at the top:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:19:08) [MSC v.1500 32 bit (Intel)] on win32&lt;BR /&gt;Type "help", "copyright", "credits" or "license()" for more information.&lt;/P&gt;&lt;P&gt;You can also use: python at a normal cmd prompt and it should list what python interpreter the system (and most likely the python that is being used to execute in bat file) is using.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 20:41:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1200051#M65227</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-08-05T20:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: URLLib.Request Errors</title>
      <link>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1200259#M65236</link>
      <description>&lt;P&gt;this might help:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;        fsURL = "http://yourwebsite.com"
        payload3 = {'updates': updateAttr, 'f': 'json','token' : aToken}
        r3 = requests.get(fsURL, params=payload3, proxies=proxies)
        print(r3.text)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;just ignore the payload if you dont need to pass any parameters, same goes for the proxy&lt;/P&gt;&lt;P&gt;forgot to say the above just uses requests&lt;/P&gt;&lt;P&gt;Stu&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 06:28:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1200259#M65236</guid>
      <dc:creator>StuartMoore</dc:creator>
      <dc:date>2022-08-08T06:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: URLLib.Request Errors</title>
      <link>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1200356#M65239</link>
      <description>&lt;P&gt;OK so here is where I am currently at.&amp;nbsp; I am pretty confused why this is not working....&lt;/P&gt;&lt;P&gt;Below are my 4 options when I go to run the .py file&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jaykapalczynski_0-1659960755698.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/48019iBB7EDF9CFCC0CC44/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jaykapalczynski_0-1659960755698.png" alt="jaykapalczynski_0-1659960755698.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Code&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This is the URL I am using&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
import requests
import json
import uuid
from urllib.request import urlopen
import urllib
import requests

url = "https://dwr.virginia.gov/-/api/v1/vbwt-sites/"
response = urlopen(url)
data_json = json.loads(response.read)
print (data_json)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1st Option - Edit with IDLE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This open it in IDLE 2.7 which was a prior install of python that is on this computer&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jaykapalczynski_4-1659961046738.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/48023i440956D5FE339299/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jaykapalczynski_4-1659961046738.png" alt="jaykapalczynski_4-1659961046738.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Error -&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Traceback (most recent call last):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;File "C:\Users\tjv36463\Desktop\JSONSamples\readJson.py", line 5, in &amp;lt;module&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;from urllib.request import urlopen&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ImportError: No module named request&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2nd Option - Edit with IDLE (ArcGIS Pro)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If I choose this option&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jaykapalczynski_2-1659960967425.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/48021i74B8E0364DCF822C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jaykapalczynski_2-1659960967425.png" alt="jaykapalczynski_2-1659960967425.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Error -&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Traceback (most recent call last):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;File "C:\Users\tjv36463\Desktop\JSONSamples\readJson.py", line 13, in &amp;lt;module&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;response = urlopen(url)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 222, in urlopen&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;return opener.open(url, data, timeout)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 531, in open&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;response = meth(req, response)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 641, in http_response&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;'http', request, response, code, msg, hdrs)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 569, in error&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;return self._call_chain(*args)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 503, in _call_chain&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;result = func(*args)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 649, in http_error_default&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;raise HTTPError(req.full_url, code, msg, hdrs, fp)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;urllib.error.HTTPError: HTTP Error 403: Forbidden&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3rd Option - Edit with IDLE (Edit with IDLE 3.10 (64-bit))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The 3rd options opens in this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jaykapalczynski_3-1659961017751.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/48022i0E3185B265581157/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jaykapalczynski_3-1659961017751.png" alt="jaykapalczynski_3-1659961017751.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Error -&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Traceback (most recent call last):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;File "C:\Users\tjv36463\Desktop\JSONSamples\readJson.py", line 1, in &amp;lt;module&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;import arcpy&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ModuleNotFoundError: No module named 'arcpy'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If I run it from PYTHON command prompt I get this&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jaykapalczynski_6-1659962695323.png" style="width: 769px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/48027iDF3EB7F91C21ECB0/image-dimensions/769x275?v=v2" width="769" height="275" role="button" title="jaykapalczynski_6-1659962695323.png" alt="jaykapalczynski_6-1659962695323.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 13:01:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1200356#M65239</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2022-08-08T13:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: URLLib.Request Errors</title>
      <link>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1200363#M65240</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/50919"&gt;@jaykapalczynski&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;i just tried this and it seemed to work and pulled back 648 records&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import requests
import json

fsURL = "https://dwr.virginia.gov/-/api/v1/vbwt-sites"
r3 = requests.get(fsURL)

res = json.loads (r3.text)

print(len(res))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="StuartMoore_0-1659964520362.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/48034i67B3216EB44951F5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="StuartMoore_0-1659964520362.png" alt="StuartMoore_0-1659964520362.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;that was done with idle for ArcGIS Pro&lt;/P&gt;&lt;P&gt;hope that helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Stu&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 13:16:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1200363#M65240</guid>
      <dc:creator>StuartMoore</dc:creator>
      <dc:date>2022-08-08T13:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: URLLib.Request Errors</title>
      <link>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1200364#M65241</link>
      <description>&lt;P&gt;Use option 2.&amp;nbsp; Since you are getting an API response (the JSON), you need to use a different urllib method.&lt;/P&gt;&lt;P&gt;PS- its good practise to look at the sites robots.txt file to see what they allow as far as automation/scraping.&lt;/P&gt;&lt;P&gt;&lt;A href="https://dwr.virginia.gov/robots.txt" target="_blank" rel="noopener"&gt;https://dwr.virginia.gov/robots.txt&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
import requests
import json
import uuid
import urllib
# import requests &amp;lt;- duplicate import

url = "https://dwr.virginia.gov/-/api/v1/vbwt-sites/"

# add the headers because the server doesnt allow resquests from python
response = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
infile=urllib.request.urlopen(response).read()
data_json = json.loads(infile)
print (data_json)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 13:20:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1200364#M65241</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-08-08T13:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: URLLib.Request Errors</title>
      <link>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1200367#M65242</link>
      <description>&lt;P&gt;Just for FYI, option one (2.7) IDLE is using the Python 2.7 environment, which you noted is from an old install, (but may still be used for other programs) and since you have been working in 3.10, this 2.7 will not have any of the packages that you installed. And its syntax is different so it would most likely fail trying to interpret the 3.x syntax.&lt;/P&gt;&lt;P&gt;Option 2 is pointing to the IDLE packaged with Pro, so good there.&lt;/P&gt;&lt;P&gt;Option 3 is pointing to the base Python3.10 install for your system and since Pro has it's own, arcpy is not installed into the system environment.&lt;/P&gt;&lt;P&gt;Option 4 is good, but it was getting tripped up trying to decode the page.&lt;/P&gt;&lt;P&gt;Take a look at getting another python editor- like pycharm, vs code, spyder... Set these to your Pro python environment and things may be a little easier for your development.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 13:33:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/urllib-request-errors/m-p/1200367#M65242</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-08-08T13:33:07Z</dc:date>
    </item>
  </channel>
</rss>

