<?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: Using the ArcGIS API for Python with a REST service in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/1058511#M61151</link>
    <description>&lt;P&gt;It helps to share a code snippet that replicates the error and the exact error message.&amp;nbsp; The example above is for connecting to a Portal/AGOL layer, and you are talking about stand-alone ArcGIS Server.&amp;nbsp; It may be the same code works, but it very well may not.&lt;/P&gt;</description>
    <pubDate>Mon, 17 May 2021 14:08:56 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2021-05-17T14:08:56Z</dc:date>
    <item>
      <title>Using the ArcGIS API for Python with a REST service</title>
      <link>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/422483#M33210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey All- I have a public REST service that has several layers and feature classes that I want to access. According to the documentation. Once I have the 'arcgis' package imported, I can inject my outside REST service as such:&lt;/P&gt;&lt;P&gt;&amp;nbsp;*Note: I am using the Jupyter Notebook to test this code.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="" style="color: #008000; font-weight: bold;"&gt;from&lt;/SPAN&gt; &lt;SPAN class="" style="color: #0000ff; font-weight: bold;"&gt;arcgis.gis&lt;/SPAN&gt; &lt;SPAN class="" style="color: #008000; font-weight: bold;"&gt;import&lt;/SPAN&gt; &lt;SPAN class=""&gt;GIS
&lt;/SPAN&gt;&lt;SPAN class=""&gt;gis&lt;/SPAN&gt; &lt;SPAN class="" style="color: #666666;"&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;GIS&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #ba2121;"&gt;"&lt;A class="link-bare" href="https://hazards.fema.gov/gis/nfhl/rest/services/CSLF/Prelim_CSLF/MapServer" title="https://hazards.fema.gov/gis/nfhl/rest/services/CSLF/Prelim_CSLF/MapServer" rel="nofollow noopener noreferrer" target="_blank"&gt;https://hazards.fema.gov/gis/nfhl/rest/services/CSLF/Prelim_CSLF/MapServer&lt;/A&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;)

&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Since this is a public service, I didn't have to include any username or password parameters.&amp;nbsp;The service has several layers (item_type="Feature Layer) that I want to access; namely Special Flood Hazard Area Change layer, but perhaps others:&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="418759" class="image-1 jive-image" height="555" src="https://community.esri.com/legacyfs/online/418759_pastedImage_5.png" width="663" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the &lt;A href="https://developers.arcgis.com/python/guide/accessing-and-creating-content/" rel="nofollow noopener noreferrer" target="_blank"&gt;example&lt;/A&gt;&amp;nbsp;from the API docs, I tried to do a search in the service just to see all the layers and any info I might need in future calls. I am using the '.search' method from the content manager.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="" style="color: #408080;"&gt;# search and list all feature layers in my contents
&lt;/SPAN&gt;search_result &lt;SPAN class="" style="color: #666666;"&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;gis&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666666;"&gt;.&lt;/SPAN&gt;&lt;SPAN class=""&gt;content&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666666;"&gt;.&lt;/SPAN&gt;&lt;SPAN class=""&gt;search&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;query&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666666;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #ba2121;"&gt;""&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;item_type&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666666;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #ba2121;"&gt;"Feature Layer"&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt; 
&lt;SPAN class=""&gt;search_result&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;P&gt;Every time I try this, I get an either a KeyError='num' or a TypeError: must be str, not int (if I try to add a query). What am I doing wrong here and what is the proper way to search within this REST service?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="418763" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/418763_pastedImage_52.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:05:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/422483#M33210</guid>
      <dc:creator>JustinBridwell2</dc:creator>
      <dc:date>2021-12-11T19:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using the ArcGIS API for Python with a REST service</title>
      <link>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/422484#M33211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;According to the documentation.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;What documentation, exactly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to &lt;A class="link-titled" href="https://esri.github.io/arcgis-python-api/apidoc/html/" title="https://esri.github.io/arcgis-python-api/apidoc/html/" rel="nofollow noopener noreferrer" target="_blank"&gt;API Reference for the ArcGIS API for Python — arcgis 1.4.2 documentation&lt;/A&gt;, a GIS object "&lt;SPAN style="color: #404040; font-family: Lato, proxima-nova, 'Helvetica Neue', Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #fcfcfc; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt;is representative of a single ArcGIS Online organization or an ArcGIS Enterprise deployment," and the "constructor constructs a GIS object given a url and user credentials to ArcGIS Online or an ArcGIS Enterprise Portal."&amp;nbsp; The service you reference is not part of ArcGIS Online or an ArcGIS Enterprise Portal, it is a map service published from an unfederated ArcGIS Server.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #404040; font-family: Lato, proxima-nova, 'Helvetica Neue', Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #fcfcfc; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt;If you are interested in accessing the properties of an individual map service, you can use the &lt;A class="link-titled" href="https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.mapping.html" title="https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.mapping.html" rel="nofollow noopener noreferrer" target="_blank"&gt;arcgis.mapping module — arcgis 1.4.2 documentation&lt;/A&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcgis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; MapImageLayer
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; mil &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; MapImageLayer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fhazards.fema.gov%2Fgis%2Fnfhl%2Frest%2Fservices%2FCSLF%2FPrelim_CSLF%2FMapServer" target="_blank"&gt;https://hazards.fema.gov/gis/nfhl/rest/services/CSLF/Prelim_CSLF/MapServer&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; lyr &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; mil&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layers&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;properties&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"name"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;properties&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"type"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
Preliminary Group Layer
Coastal High Hazard Area Change Feature Layer
Floodway Change Feature Layer
Special Flood Hazard Area Change Feature Layer
Non&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;Special Flood Hazard Area Change&amp;nbsp; Feature Layer
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="color: #404040; font-family: Lato, proxima-nova, 'Helvetica Neue', Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #fcfcfc; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:05:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/422484#M33211</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T19:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using the ArcGIS API for Python with a REST service</title>
      <link>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/422485#M33212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK. That is exactly what I was looking for. It appears I missed the part about using that functionality (GIS and .content.search) with an outside service. However, what if I added that service in my arcGIS online account? I could access it that way, right? BTW- Your mapping module idea looks like it will work fine as well.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2018 18:35:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/422485#M33212</guid>
      <dc:creator>JustinBridwell2</dc:creator>
      <dc:date>2018-08-15T18:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using the ArcGIS API for Python with a REST service</title>
      <link>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/422486#M33213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. I was trying to get information for layers within map services by using "layers" on the web map object, and trying to get information out when layerType = "ArcGISMapServiceLayer" and getting nowhere.&amp;nbsp;&lt;/P&gt;&lt;P&gt;properties on map image layer layers is what I needed.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Apr 2019 18:00:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/422486#M33213</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-04-10T18:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using the ArcGIS API for Python with a REST service</title>
      <link>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/422487#M33214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where would I find a description of which properties I have access to when working with a layer from a map image layer object?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am still learning how to navigate the API documentation and am finding it a bit daunting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Randy McGregor.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Apr 2019 18:07:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/422487#M33214</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-04-10T18:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using the ArcGIS API for Python with a REST service</title>
      <link>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/422488#M33215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am assuming you are searching or browsing here:&amp;nbsp; &lt;A class="link-titled" href="https://esri.github.io/arcgis-python-api/apidoc/html/index.html" title="https://esri.github.io/arcgis-python-api/apidoc/html/index.html"&gt;API Reference for the ArcGIS API for Python — arcgis 1.6.0 documentation&lt;/A&gt;&amp;nbsp;.&amp;nbsp; I would start with &lt;A class="link-titled" href="https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.mapping.html#mapimagelayer" title="https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.mapping.html#mapimagelayer"&gt;MapImageLayer&lt;/A&gt; and &lt;A class="link-titled" href="https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.mapping.html#mapimagelayermanager" title="https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.mapping.html#mapimagelayermanager"&gt;MapImageLayerManager&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Apr 2019 20:13:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/422488#M33215</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-04-10T20:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using the ArcGIS API for Python with a REST service</title>
      <link>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/422489#M33216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. I have checked MapImageLayer documentation, but what I don't understand is how I can get a list of what properties are available. Clearly "name" and "type" are, but I don't know what else is, and don't know where I would find it. I would like to list fields, field aliases, source data, popup information, etc... Is that all available via mapimagelayer? I don't want any one to just feed me an answer to every question, but I guess I need a little help figuring out how to navigate the documentation to find answers to specific questions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Randy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Apr 2019 01:32:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/422489#M33216</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-04-11T01:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using the ArcGIS API for Python with a REST service</title>
      <link>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/422490#M33217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"keys" is the answer to your question, Randy.&lt;/P&gt;&lt;P&gt;for example,&lt;/P&gt;&lt;P&gt;"lyr.keys" will tell what keys are available for a particular layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2019 15:01:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/422490#M33217</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-05-23T15:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using the ArcGIS API for Python with a REST service</title>
      <link>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/1058420#M61145</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working in a secure environment that only has connection to the map server that i want to use. I have no access to the internet&lt;/P&gt;&lt;P&gt;In this case, whenever i use the above suggested method to connect to the standalone arcgis server, i get a connection error as it seems that the arcgis python api is attempting to authenticate to &lt;A href="http://www.arcgis.com" target="_blank"&gt;www.arcgis.com&lt;/A&gt;&amp;nbsp;as an anonymous user.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to use the MapImageLayer with the rest API without first authenticating / connecting to any arcgis enterprise or arcgis portals?&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 09:02:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/1058420#M61145</guid>
      <dc:creator>darrenng123123</dc:creator>
      <dc:date>2021-05-17T09:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Using the ArcGIS API for Python with a REST service</title>
      <link>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/1058511#M61151</link>
      <description>&lt;P&gt;It helps to share a code snippet that replicates the error and the exact error message.&amp;nbsp; The example above is for connecting to a Portal/AGOL layer, and you are talking about stand-alone ArcGIS Server.&amp;nbsp; It may be the same code works, but it very well may not.&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 14:08:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/1058511#M61151</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-05-17T14:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using the ArcGIS API for Python with a REST service</title>
      <link>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/1058811#M61167</link>
      <description>&lt;P&gt;This is the code i am running. Its the exact same code except for the url change. Unfortunately i cannot give you the exact URL, not that it matters because its within our organisation's intranet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;from arcgis.mapping import MapImageLayermil = MapImageLayer(r"https://xxx.xxx.xx/arcgis/rest/services/MapServices/xxxxxx/MapServer",gis=None)for layer in mil.layers:
    print(layer.properties["name"], layer.properties["type"])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is the error code i got. To add, i verified that i am able to resolve the url from my environment&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;---------------------------------------------------------------------------
gaierror                                  Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/urllib3/connection.py in _new_conn(self)
    156             conn = connection.create_connection(
--&amp;gt; 157                 (self._dns_host, self.port), self.timeout, **extra_kw
    158             )
/opt/conda/lib/python3.7/site-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options)
     60 
---&amp;gt; 61     for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
     62         af, socktype, proto, canonname, sa = res
/opt/conda/lib/python3.7/socket.py in getaddrinfo(host, port, family, type, proto, flags)
    747     addrlist = []
--&amp;gt; 748     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
    749         af, socktype, proto, canonname, sa = res
gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
NewConnectionError                        Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    671                 headers=headers,
--&amp;gt; 672                 chunked=chunked,
    673             )
/opt/conda/lib/python3.7/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    375         try:
--&amp;gt; 376             self._validate_conn(conn)
    377         except (SocketTimeout, BaseSSLError) as e:
/opt/conda/lib/python3.7/site-packages/urllib3/connectionpool.py in _validate_conn(self, conn)
    993         if not getattr(conn, "sock", None):  # AppEngine might not have  `.sock`
--&amp;gt; 994             conn.connect()
    995 
/opt/conda/lib/python3.7/site-packages/urllib3/connection.py in connect(self)
    333         # Add certificate verification
--&amp;gt; 334         conn = self._new_conn()
    335         hostname = self.host
/opt/conda/lib/python3.7/site-packages/urllib3/connection.py in _new_conn(self)
    168             raise NewConnectionError(
--&amp;gt; 169                 self, "Failed to establish a new connection: %s" % e
    170             )
NewConnectionError: &amp;lt;urllib3.connection.VerifiedHTTPSConnection object at 0x7ff1811f1a90&amp;gt;: Failed to establish a new connection: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
MaxRetryError                             Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    448                     retries=self.max_retries,
--&amp;gt; 449                     timeout=timeout
    450                 )
/opt/conda/lib/python3.7/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    719             retries = retries.increment(
--&amp;gt; 720                 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
    721             )
/opt/conda/lib/python3.7/site-packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
    435         if new_retry.is_exhausted():
--&amp;gt; 436             raise MaxRetryError(_pool, url, error or ResponseError(cause))
    437 
MaxRetryError: HTTPSConnectionPool(host='www.arcgis.com', port=443): Max retries exceeded with url: /sharing/rest/portals/self (Caused by NewConnectionError('&amp;lt;urllib3.connection.VerifiedHTTPSConnection object at 0x7ff1811f1a90&amp;gt;: Failed to establish a new connection: [Errno -2] Name or service not known'))
During handling of the above exception, another exception occurred:
ConnectionError                           Traceback (most recent call last)
~/.local/lib/python3.7/site-packages/arcgis/gis/_impl/_con/_connection.py in post(self, path, params, files, **kwargs)
    686                                           cert=cert,
--&amp;gt; 687                                           files=files)
    688         except requests.exceptions.SSLError as err:
/opt/conda/lib/python3.7/site-packages/requests/sessions.py in post(self, url, data, json, **kwargs)
    580 
--&amp;gt; 581         return self.request('POST', url, data=data, json=json, **kwargs)
    582 
/opt/conda/lib/python3.7/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    532         send_kwargs.update(settings)
--&amp;gt; 533         resp = self.send(prep, **send_kwargs)
    534 
/opt/conda/lib/python3.7/site-packages/requests/sessions.py in send(self, request, **kwargs)
    645         # Send the request
--&amp;gt; 646         r = adapter.send(request, **kwargs)
    647 
/opt/conda/lib/python3.7/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    515 
--&amp;gt; 516             raise ConnectionError(e, request=request)
    517 
ConnectionError: HTTPSConnectionPool(host='www.arcgis.com', port=443): Max retries exceeded with url: /sharing/rest/portals/self (Caused by NewConnectionError('&amp;lt;urllib3.connection.VerifiedHTTPSConnection object at 0x7ff1811f1a90&amp;gt;: Failed to establish a new connection: [Errno -2] Name or service not known'))
During handling of the above exception, another exception occurred:
ConnectionError                           Traceback (most recent call last)
&amp;lt;ipython-input-42-293792572c7c&amp;gt; in &amp;lt;module&amp;gt;
      1 from arcgis.mapping import MapImageLayer
      2 
----&amp;gt; 3 mil = MapImageLayer(r"https://xxxxx.xxx.xxxx/arcgis/rest/services/MapServices/xxxxxxxx/MapServer",gis=None)
      4 
      5 for layer in mil.layers:
~/.local/lib/python3.7/site-packages/arcgis/mapping/_types.py in __init__(self, url, gis)
   3312         :param gis: the GIS to which this layer belongs
   3313         """
-&amp;gt; 3314         super(MapImageLayer, self).__init__(url, gis)
   3315 
   3316         self._populate_layers()
~/.local/lib/python3.7/site-packages/arcgis/gis/__init__.py in __init__(self, url, gis)
  11561 
  11562     def __init__(self, url, gis=None):
&amp;gt; 11563         super(Layer, self).__init__(url, gis)
  11564         self.filter = None
  11565         self._time_filter = None
~/.local/lib/python3.7/site-packages/arcgis/gis/__init__.py in __init__(self, url, gis)
  11412 
  11413         if gis is None:
&amp;gt; 11414             gis = GIS(set_active=False)
  11415             self._gis = gis
  11416             self._con = gis._con
~/.local/lib/python3.7/site-packages/arcgis/gis/__init__.py in __init__(self, url, username, password, key_file, cert_file, verify_cert, set_active, client_id, profile, **kwargs)
    357                                    "argument when connecting to the GIS.")
    358             else:
--&amp;gt; 359                 raise e
    360         try:
    361             if url.lower().find("arcgis.com") &amp;gt; -1 and \
~/.local/lib/python3.7/site-packages/arcgis/gis/__init__.py in __init__(self, url, username, password, key_file, cert_file, verify_cert, set_active, client_id, profile, **kwargs)
    341                                            custom_auth=custom_auth, #token=self._utoken,
    342                                            client_secret=client_secret,
--&amp;gt; 343                                            trust_env=kwargs.get("trust_env", None))
    344             if self._is_hosted_nb_home:
    345                 # For GIS("home") objects, force no referer passed in
~/.local/lib/python3.7/site-packages/arcgis/gis/_impl/_portalpy.py in __init__(self, url, username, password, key_file, cert_file, expiration, referer, proxy_host, proxy_port, connection, workdir, tokenurl, verify_cert, client_id, custom_auth, token, **kwargs)
    171                                       trust_env=trust_env)
    172         #self.get_version(True)
--&amp;gt; 173         self.get_properties(True)
    174 
    175 
~/.local/lib/python3.7/site-packages/arcgis/gis/_impl/_portalpy.py in get_properties(self, force)
   1136                     resp = self.con.get(path, ssl=True) # issue seen with key, cert auth
   1137                 if not resp:
-&amp;gt; 1138                     raise e
   1139 
   1140             if resp:
~/.local/lib/python3.7/site-packages/arcgis/gis/_impl/_portalpy.py in get_properties(self, force)
   1124             resp = None
   1125             try:
-&amp;gt; 1126                 resp = self.con.post(path, self._postdata(), ssl=True)
   1127             except Exception as e:
   1128                 if not self.con._verify_cert and \
~/.local/lib/python3.7/site-packages/arcgis/gis/_impl/_con/_connection.py in post(self, path, params, files, **kwargs)
    694         except requests.exceptions.ConnectionError as errCE:
    695             raise requests.exceptions.ConnectionError(
--&amp;gt; 696                 "A connection error has occurred: %s" % errCE)
    697         except requests.exceptions.InvalidHeader as errIH:
    698             raise requests.exceptions.InvalidHeader(
ConnectionError: A connection error has occurred: HTTPSConnectionPool(host='www.arcgis.com', port=443): Max retries exceeded with url: /sharing/rest/portals/self (Caused by NewConnectionError('&amp;lt;urllib3.connection.VerifiedHTTPSConnection object at 0x7ff1811f1a90&amp;gt;: Failed to establish a new connection: [Errno -2] Name or service not known'))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 02:35:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/1058811#M61167</guid>
      <dc:creator>darrenng123123</dc:creator>
      <dc:date>2021-05-18T02:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using the ArcGIS API for Python with a REST service</title>
      <link>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/1058821#M61168</link>
      <description>&lt;P&gt;Here is the code that i am using. Its the exact same one as suggested. Unfortunately i cannot share the url that i am connecting to, not that it matters because it is hosted in our organisation's intranet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;from arcgis.mapping import MapImageLayer
mil = MapImageLayer(r"https://xxx.xxx.xx/arcgis/rest/services/MapServices/xxxxxx/MapServer",gis=None)
for layer in mil.layers:
    print(layer.properties["name"], layer.properties["type"])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and here is the error code: also note that the mapserver url used is resolvable in my environment :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;---------------------------------------------------------------------------
gaierror                                  Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/urllib3/connection.py in _new_conn(self)
    156             conn = connection.create_connection(
--&amp;gt; 157                 (self._dns_host, self.port), self.timeout, **extra_kw
    158             )
/opt/conda/lib/python3.7/site-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options)
     60 
---&amp;gt; 61     for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
     62         af, socktype, proto, canonname, sa = res
/opt/conda/lib/python3.7/socket.py in getaddrinfo(host, port, family, type, proto, flags)
    747     addrlist = []
--&amp;gt; 748     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
    749         af, socktype, proto, canonname, sa = res
gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
NewConnectionError                        Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    671                 headers=headers,
--&amp;gt; 672                 chunked=chunked,
    673             )
/opt/conda/lib/python3.7/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    375         try:
--&amp;gt; 376             self._validate_conn(conn)
    377         except (SocketTimeout, BaseSSLError) as e:
/opt/conda/lib/python3.7/site-packages/urllib3/connectionpool.py in _validate_conn(self, conn)
    993         if not getattr(conn, "sock", None):  # AppEngine might not have  `.sock`
--&amp;gt; 994             conn.connect()
    995 
/opt/conda/lib/python3.7/site-packages/urllib3/connection.py in connect(self)
    333         # Add certificate verification
--&amp;gt; 334         conn = self._new_conn()
    335         hostname = self.host
/opt/conda/lib/python3.7/site-packages/urllib3/connection.py in _new_conn(self)
    168             raise NewConnectionError(
--&amp;gt; 169                 self, "Failed to establish a new connection: %s" % e
    170             )
NewConnectionError: &amp;lt;urllib3.connection.VerifiedHTTPSConnection object at 0x7ff1811f1a90&amp;gt;: Failed to establish a new connection: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
MaxRetryError                             Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    448                     retries=self.max_retries,
--&amp;gt; 449                     timeout=timeout
    450                 )
/opt/conda/lib/python3.7/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    719             retries = retries.increment(
--&amp;gt; 720                 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
    721             )
/opt/conda/lib/python3.7/site-packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
    435         if new_retry.is_exhausted():
--&amp;gt; 436             raise MaxRetryError(_pool, url, error or ResponseError(cause))
    437 
MaxRetryError: HTTPSConnectionPool(host='www.arcgis.com', port=443): Max retries exceeded with url: /sharing/rest/portals/self (Caused by NewConnectionError('&amp;lt;urllib3.connection.VerifiedHTTPSConnection object at 0x7ff1811f1a90&amp;gt;: Failed to establish a new connection: [Errno -2] Name or service not known'))
During handling of the above exception, another exception occurred:
ConnectionError                           Traceback (most recent call last)
~/.local/lib/python3.7/site-packages/arcgis/gis/_impl/_con/_connection.py in post(self, path, params, files, **kwargs)
    686                                           cert=cert,
--&amp;gt; 687                                           files=files)
    688         except requests.exceptions.SSLError as err:
/opt/conda/lib/python3.7/site-packages/requests/sessions.py in post(self, url, data, json, **kwargs)
    580 
--&amp;gt; 581         return self.request('POST', url, data=data, json=json, **kwargs)
    582 
/opt/conda/lib/python3.7/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    532         send_kwargs.update(settings)
--&amp;gt; 533         resp = self.send(prep, **send_kwargs)
    534 
/opt/conda/lib/python3.7/site-packages/requests/sessions.py in send(self, request, **kwargs)
    645         # Send the request
--&amp;gt; 646         r = adapter.send(request, **kwargs)
    647 
/opt/conda/lib/python3.7/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    515 
--&amp;gt; 516             raise ConnectionError(e, request=request)
    517 
ConnectionError: HTTPSConnectionPool(host='www.arcgis.com', port=443): Max retries exceeded with url: /sharing/rest/portals/self (Caused by NewConnectionError('&amp;lt;urllib3.connection.VerifiedHTTPSConnection object at 0x7ff1811f1a90&amp;gt;: Failed to establish a new connection: [Errno -2] Name or service not known'))
During handling of the above exception, another exception occurred:
ConnectionError                           Traceback (most recent call last)
&amp;lt;ipython-input-42-293792572c7c&amp;gt; in &amp;lt;module&amp;gt;
      1 from arcgis.mapping import MapImageLayer
      2 
----&amp;gt; 3 mil = MapImageLayer(r"https://xxxxx.xxx.xxxx/arcgis/rest/services/MapServices/xxxxxxxx/MapServer",gis=None)
      4 
      5 for layer in mil.layers:
~/.local/lib/python3.7/site-packages/arcgis/mapping/_types.py in __init__(self, url, gis)
   3312         :param gis: the GIS to which this layer belongs
   3313         """
-&amp;gt; 3314         super(MapImageLayer, self).__init__(url, gis)
   3315 
   3316         self._populate_layers()
~/.local/lib/python3.7/site-packages/arcgis/gis/__init__.py in __init__(self, url, gis)
  11561 
  11562     def __init__(self, url, gis=None):
&amp;gt; 11563         super(Layer, self).__init__(url, gis)
  11564         self.filter = None
  11565         self._time_filter = None
~/.local/lib/python3.7/site-packages/arcgis/gis/__init__.py in __init__(self, url, gis)
  11412 
  11413         if gis is None:
&amp;gt; 11414             gis = GIS(set_active=False)
  11415             self._gis = gis
  11416             self._con = gis._con
~/.local/lib/python3.7/site-packages/arcgis/gis/__init__.py in __init__(self, url, username, password, key_file, cert_file, verify_cert, set_active, client_id, profile, **kwargs)
    357                                    "argument when connecting to the GIS.")
    358             else:
--&amp;gt; 359                 raise e
    360         try:
    361             if url.lower().find("arcgis.com") &amp;gt; -1 and \
~/.local/lib/python3.7/site-packages/arcgis/gis/__init__.py in __init__(self, url, username, password, key_file, cert_file, verify_cert, set_active, client_id, profile, **kwargs)
    341                                            custom_auth=custom_auth, #token=self._utoken,
    342                                            client_secret=client_secret,
--&amp;gt; 343                                            trust_env=kwargs.get("trust_env", None))
    344             if self._is_hosted_nb_home:
    345                 # For GIS("home") objects, force no referer passed in
~/.local/lib/python3.7/site-packages/arcgis/gis/_impl/_portalpy.py in __init__(self, url, username, password, key_file, cert_file, expiration, referer, proxy_host, proxy_port, connection, workdir, tokenurl, verify_cert, client_id, custom_auth, token, **kwargs)
    171                                       trust_env=trust_env)
    172         #self.get_version(True)
--&amp;gt; 173         self.get_properties(True)
    174 
    175 
~/.local/lib/python3.7/site-packages/arcgis/gis/_impl/_portalpy.py in get_properties(self, force)
   1136                     resp = self.con.get(path, ssl=True) # issue seen with key, cert auth
   1137                 if not resp:
-&amp;gt; 1138                     raise e
   1139 
   1140             if resp:
~/.local/lib/python3.7/site-packages/arcgis/gis/_impl/_portalpy.py in get_properties(self, force)
   1124             resp = None
   1125             try:
-&amp;gt; 1126                 resp = self.con.post(path, self._postdata(), ssl=True)
   1127             except Exception as e:
   1128                 if not self.con._verify_cert and \
~/.local/lib/python3.7/site-packages/arcgis/gis/_impl/_con/_connection.py in post(self, path, params, files, **kwargs)
    694         except requests.exceptions.ConnectionError as errCE:
    695             raise requests.exceptions.ConnectionError(
--&amp;gt; 696                 "A connection error has occurred: %s" % errCE)
    697         except requests.exceptions.InvalidHeader as errIH:
    698             raise requests.exceptions.InvalidHeader(
ConnectionError: A connection error has occurred: HTTPSConnectionPool(host='www.arcgis.com', port=443): Max retries exceeded with url: /sharing/rest/portals/self (Caused by NewConnectionError('&amp;lt;urllib3.connection.VerifiedHTTPSConnection object at 0x7ff1811f1a90&amp;gt;: Failed to establish a new connection: [Errno -2] Name or service not known'))&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 18 May 2021 04:02:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-the-arcgis-api-for-python-with-a-rest/m-p/1058821#M61168</guid>
      <dc:creator>darrenng123123</dc:creator>
      <dc:date>2021-05-18T04:02:28Z</dc:date>
    </item>
  </channel>
</rss>

