<?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: Error when querying online layer with API in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/error-when-querying-online-layer-with-api/m-p/747578#M302</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That did the trick! I'm still trying to figure out what changed to cause it to stop working so suddenly but at least I can proceed now. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Mar 2019 15:49:11 GMT</pubDate>
    <dc:creator>JasonJordan00</dc:creator>
    <dc:date>2019-03-27T15:49:11Z</dc:date>
    <item>
      <title>Error when querying online layer with API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/error-when-querying-online-layer-with-api/m-p/747576#M300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All of a sudden I am experiencing errors when working with the ArcGIS Python API with a code taken straight from the API guide. There was no difference in my PC's configuration from when my (very simple) code worked and when it stopped. Literally the errors started within minutes in between runs. No updates, no new installations, nothing. I've tried restarting, reinstalling the API, Python, NumPy, Pandas, and others. I've also tried downgrading most of their versions. Currently I have API version 1.6.0 with Python 3.7. Any help with this would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcgis&lt;BR /&gt;from arcgis.gis import GIS&lt;/P&gt;&lt;P&gt;gis_url = '####'&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;username&amp;nbsp;= '####'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;password&amp;nbsp;= '####'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;gis = GIS(gis_url, username, password)&lt;/P&gt;&lt;P&gt;object_point = gis.content.search("Points_Layer_Test")[0]&lt;/P&gt;&lt;P&gt;object_point&amp;nbsp; &amp;nbsp; ##&amp;lt;-------This&amp;nbsp;displays the intended layer, so I know it's seeing it&lt;/P&gt;&lt;P&gt;object_layer = object_point.layers&lt;BR /&gt;obj_fset = object_layer[0].query()&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
c:\users\jason\appdata\local\programs\python\python37\lib\site-packages\arcgis\gis\__init__.py in __getitem__(self, k)
 6397 try:
-&amp;gt; 6398 return dict.__getitem__(self, k)
 6399 except KeyError:

KeyError: 'layers'

During handling of the above exception, another exception occurred:

KeyError Traceback (most recent call last)
&amp;lt;ipython-input-9-974ff12180c0&amp;gt; in &amp;lt;module&amp;gt;
----&amp;gt; 1 object_layer = object_point.layers
 2 obj_fset = object_layer[0].query()

c:\users\jason\appdata\local\programs\python\python37\lib\site-packages\arcgis\gis\__init__.py in __getattribute__(self, name)
 6369 def __getattribute__ (self, name):
 6370 if name == 'layers':
-&amp;gt; 6371 if self['layers'] == None or self['layers'] == []:
 6372 try:
 6373 with _DisableLogger():

c:\users\jason\appdata\local\programs\python\python37\lib\site-packages\arcgis\gis\__init__.py in __getitem__(self, k)
 6400 if not self._hydrated and not k.startswith('_'):
 6401 self._hydrate()
-&amp;gt; 6402 return dict.__getitem__(self, k)
 6403 #----------------------------------------------------------------------
 6404 @property

KeyError: 'layers'&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:47:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/error-when-querying-online-layer-with-api/m-p/747576#M300</guid>
      <dc:creator>JasonJordan00</dc:creator>
      <dc:date>2021-12-12T07:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Error when querying online layer with API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/error-when-querying-online-layer-with-api/m-p/747577#M301</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This looks right from afar, but I wonder if it's just not letting you drill down into that individual layer. Try something like this instead:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;search_layer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;layer_name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    search_results &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; agol&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;content&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;search&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;layer_name&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; item_type&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Feature Layer'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    item &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; search_results&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
    geofeatures &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; item&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layers&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; geofeatures

search_pnt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; search_layer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'pointFeatureLayer'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
query_pnt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; search_pnt&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;query&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;where&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'OBJECTID=63'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Earl&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:47:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/error-when-querying-online-layer-with-api/m-p/747577#M301</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2021-12-12T07:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: Error when querying online layer with API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/error-when-querying-online-layer-with-api/m-p/747578#M302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That did the trick! I'm still trying to figure out what changed to cause it to stop working so suddenly but at least I can proceed now. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2019 15:49:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/error-when-querying-online-layer-with-api/m-p/747578#M302</guid>
      <dc:creator>JasonJordan00</dc:creator>
      <dc:date>2019-03-27T15:49:11Z</dc:date>
    </item>
  </channel>
</rss>

