<?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: KeyError in Creating Web Map Inventory   in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763955#M460</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your suggestions to get the operational layers as a key from&lt;/P&gt;&lt;P&gt;a dictionary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using 1.4.2 version.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried to get the operational layers as a key from a dictionary,&lt;/P&gt;&lt;P&gt;still have &lt;STRONG&gt;KeyError:'layerType'.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for s in search_results:&lt;/P&gt;&lt;P&gt;    wmo = arcgis.mapping.WebMap(s)&lt;/P&gt;&lt;P&gt;    ops_layers = wmo.layers&lt;/P&gt;&lt;P&gt;    basemap_layers = wmo.basemap['baseMapLayers']&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    for op_layer in ops_layers:&lt;/P&gt;&lt;P&gt;        d = collections.OrderedDict()&lt;/P&gt;&lt;P&gt;        d["Web Map Name"] = s.title&lt;/P&gt;&lt;P&gt;        d["Web Map Item ID"] = s.itemid&lt;/P&gt;&lt;P&gt;        d["Layer Type"] = "Operational Layer&lt;/P&gt;&lt;P&gt;(&lt;SPAN __jive_macro_name="0"&gt;)".format(op_layer["layerType"])
        d["Layer URL"] = op_layer["url"]
        l.append(d)

    for base_layer in basemap_layers:
        j = collections.OrderedDict()
        j["Web Map Name"] = s.title
        j["Web Map Item ID"] = s.itemid
        j["Layer Type"] = "Basemap Layer
(&lt;/SPAN&gt;)".format(base_layer["layerType"])&lt;/P&gt;&lt;P&gt;        j["Layer URL"] = base_layer["url"]&lt;/P&gt;&lt;P&gt;        l.append(j)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chintamani&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Jul 2018 13:18:53 GMT</pubDate>
    <dc:creator>chintakandel</dc:creator>
    <dc:date>2018-07-09T13:18:53Z</dc:date>
    <item>
      <title>KeyError in Creating Web Map Inventory</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763952#M457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #545454; background-color: #eeeeee; font-size: 12.8px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I am trying to create a web map inventory and encountered a KeyError.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gis = GIS("Portal url", "username", "password")&lt;BR /&gt;search_results = gis.content.search(query="tags:streamflow", item_type="Web Map")&lt;/P&gt;&lt;P&gt;l = []&lt;BR /&gt;for s in search_results:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;wmo = arcgis.mapping.WebMap(s)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;ops_layers = wmo['operationalLayers']&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;basemap_layers = wmo['baseMap']['baseMapLayers']&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;KeyError: 'operationalLayers'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff; font-weight: 400;"&gt;Any suggestions on how to handle KeyError?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2018 20:18:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763952#M457</guid>
      <dc:creator>chintakandel</dc:creator>
      <dc:date>2018-06-20T20:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: KeyError in Creating Web Map Inventory</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763953#M458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chintamani&lt;SPAN style="font-size: 13.7136px;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.7136px;"&gt;What version of the api are you using?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.7136px;"&gt;you can check by running the following code:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="font-size: 13.7136px;"&gt;import arcgis&lt;/SPAN&gt;

&lt;SPAN style="font-size: 13.7136px;"&gt;print(arcgis.__version__)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.7136px;"&gt;Recently I had something similar and figured things out in the following way:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.7136px;"&gt;to get the operational layers as a key from a dictionary I converted the webmap to json as you see below:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;wmoJson = wmo.get_data(&lt;SPAN style="color: #660099;"&gt;try_json&lt;/SPAN&gt;=&lt;SPAN style="color: #000080; font-weight: bold;"&gt;True&lt;/SPAN&gt;)
wmo['operationalLayers']

Another access point to the operational Layers would be through the layers property
of the webmap class in the api, but access to the property in the webmap class depends on
the version of the api you have:

wmo.layers

&lt;A class="link-titled" href="https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.mapping.html?highlight=webmap" title="https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.mapping.html?highlight=webmap" rel="nofollow noopener noreferrer" target="_blank"&gt;arcgis.mapping module — arcgis 1.4.2 documentation&lt;/A&gt;&amp;nbsp;

Let me know if this helps.

Thanks,

Jeff&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:27:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763953#M458</guid>
      <dc:creator>JeffBigos</dc:creator>
      <dc:date>2021-12-12T08:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: KeyError in Creating Web Map Inventory</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763954#M459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A couple of different ways to alter your code to make it work.&amp;nbsp; Option #1:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;gis &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; GIS&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Portal url"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"username"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"password"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
search_results &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gis&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;query&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"tags:streamflow"&lt;/SPAN&gt;&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;"Web Map"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

l &lt;SPAN class="operator 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="keyword token"&gt;for&lt;/SPAN&gt; s &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; search_results&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp; wmo &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcgis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;WebMap&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;s&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp; ops_layers &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; wmo&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layers
&amp;nbsp;&amp;nbsp; basemap_layers &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; wmo&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;basemap&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'baseMapLayers'&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;Option #2&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;gis &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; GIS&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Portal url"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"username"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"password"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
search_results &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gis&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;query&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"tags:streamflow"&lt;/SPAN&gt;&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;"Web Map"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

l &lt;SPAN class="operator 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="keyword token"&gt;for&lt;/SPAN&gt; s &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; search_results&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp; wmo &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcgis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;WebMap&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;s&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp; ops_layers &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; wmo&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;definition&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'operationalLayers'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp; basemap_layers &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; wmo&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;definition&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'baseMap'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'baseMapLayers'&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:27:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763954#M459</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-12T08:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: KeyError in Creating Web Map Inventory</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763955#M460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your suggestions to get the operational layers as a key from&lt;/P&gt;&lt;P&gt;a dictionary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using 1.4.2 version.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried to get the operational layers as a key from a dictionary,&lt;/P&gt;&lt;P&gt;still have &lt;STRONG&gt;KeyError:'layerType'.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for s in search_results:&lt;/P&gt;&lt;P&gt;    wmo = arcgis.mapping.WebMap(s)&lt;/P&gt;&lt;P&gt;    ops_layers = wmo.layers&lt;/P&gt;&lt;P&gt;    basemap_layers = wmo.basemap['baseMapLayers']&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    for op_layer in ops_layers:&lt;/P&gt;&lt;P&gt;        d = collections.OrderedDict()&lt;/P&gt;&lt;P&gt;        d["Web Map Name"] = s.title&lt;/P&gt;&lt;P&gt;        d["Web Map Item ID"] = s.itemid&lt;/P&gt;&lt;P&gt;        d["Layer Type"] = "Operational Layer&lt;/P&gt;&lt;P&gt;(&lt;SPAN __jive_macro_name="0"&gt;)".format(op_layer["layerType"])
        d["Layer URL"] = op_layer["url"]
        l.append(d)

    for base_layer in basemap_layers:
        j = collections.OrderedDict()
        j["Web Map Name"] = s.title
        j["Web Map Item ID"] = s.itemid
        j["Layer Type"] = "Basemap Layer
(&lt;/SPAN&gt;)".format(base_layer["layerType"])&lt;/P&gt;&lt;P&gt;        j["Layer URL"] = base_layer["url"]&lt;/P&gt;&lt;P&gt;        l.append(j)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chintamani&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2018 13:18:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763955#M460</guid>
      <dc:creator>chintakandel</dc:creator>
      <dc:date>2018-07-09T13:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: KeyError in Creating Web Map Inventory</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763956#M461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Chintamani,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking through the code you have provided I see something that could be causing empty operational layers in the resulting dictionary:&lt;/P&gt;&lt;P&gt;in your format function change the () to { } as you see below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;d[&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Layer Type"&lt;/SPAN&gt;] = &lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Operational Layer{}"&lt;/SPAN&gt;.format(op_layer[&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"layerType"&lt;/SPAN&gt;])

Another spot I see that is on the following line:
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;j[&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"LayerType"&lt;/SPAN&gt;] = &lt;SPAN style="color: #008080; font-weight: bold;"&gt;"BasemapLayer{}"&lt;/SPAN&gt;.format(base_layer[&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"layerType"&lt;/SPAN&gt;])&lt;/PRE&gt;Try out that change and let me know how it goes.&lt;BR /&gt;&lt;BR /&gt;Thanks, &lt;BR /&gt;&lt;BR /&gt;Jeff&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:27:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763956#M461</guid>
      <dc:creator>JeffBigos</dc:creator>
      <dc:date>2021-12-12T08:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: KeyError in Creating Web Map Inventory</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763957#M462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your suggestions. I have changed my format function but still&lt;/P&gt;&lt;P&gt;encounter a layerType keyError.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chintamani&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2018 18:58:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763957#M462</guid>
      <dc:creator>chintakandel</dc:creator>
      <dc:date>2018-07-12T18:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: KeyError in Creating Web Map Inventory </title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763958#M463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chintamani,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your code above, I see 2 spots where you are using the layer type key:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;d[&lt;SPAN style="color: #008080; border: 0px; font-weight: bold; font-size: 16.6667px;"&gt;"Layer Type"&lt;/SPAN&gt;] = &lt;SPAN style="color: #008080; border: 0px; font-weight: bold; font-size: 16.6667px;"&gt;"Operational Layer{}"&lt;/SPAN&gt;.format(op_layer[&lt;SPAN style="color: #008080; border: 0px; font-weight: bold; font-size: 16.6667px;"&gt;"layerType"&lt;/SPAN&gt;])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.j[&lt;SPAN style="color: #008080; border: 0px; font-weight: bold; font-size: 16.6667px;"&gt;"LayerType"&lt;/SPAN&gt;] = &lt;SPAN style="color: #008080; border: 0px; font-weight: bold; font-size: 16.6667px;"&gt;"BasemapLayer{}"&lt;/SPAN&gt;.format(base_layer[&lt;SPAN style="color: #008080; border: 0px; font-weight: bold; font-size: 16.6667px;"&gt;"layerType"&lt;/SPAN&gt;])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when you see the error which of those lines is the error occurring with?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2018 16:23:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763958#M463</guid>
      <dc:creator>JeffBigos</dc:creator>
      <dc:date>2018-07-13T16:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: KeyError in Creating Web Map Inventory</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763959#M464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried either of my suggestions?&amp;nbsp; If so, did either work?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2018 17:26:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763959#M464</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-07-13T17:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: KeyError in Creating Web Map Inventory</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763960#M465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;layerType error occurs with both lines ( Operational Layer and&lt;/P&gt;&lt;P&gt;BasemapLayer).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code extracts all other information except layer type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chintamani&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2018 18:09:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763960#M465</guid>
      <dc:creator>chintakandel</dc:creator>
      <dc:date>2018-07-13T18:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: KeyError in Creating Web Map Inventory</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763961#M466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chintamani,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am able to use the code you provided to get all the information you are looking for in the webmaps including the layerType key. If you try the code on another webmap are you able to get the code to work through that layer type key?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In testing the code above I have been stepping through the code in my debugger. That is a nice way to gain insight into the responses and the values being returned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take a look at the above and let me know what you get.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jul 2018 15:19:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763961#M466</guid>
      <dc:creator>JeffBigos</dc:creator>
      <dc:date>2018-07-16T15:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: KeyError in Creating Web Map Inventory</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763962#M467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Joshua,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tested out the code that you provided and it works on my end.&lt;/P&gt;&lt;P&gt;It's good to see that you can access these properties in 2 different ways.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jul 2018 15:21:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763962#M467</guid>
      <dc:creator>JeffBigos</dc:creator>
      <dc:date>2018-07-16T15:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: KeyError in Creating Web Map Inventory</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763963#M468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you. I will test it to my another web map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chintamani&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2018 12:55:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763963#M468</guid>
      <dc:creator>chintakandel</dc:creator>
      <dc:date>2018-07-17T12:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: KeyError in Creating Web Map Inventory</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763964#M469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Jeff. It works for my other web maps. Greatly appreciated your&lt;/P&gt;&lt;P&gt;cooperation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chintamani&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2018 21:10:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763964#M469</guid>
      <dc:creator>chintakandel</dc:creator>
      <dc:date>2018-07-18T21:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: KeyError in Creating Web Map Inventory</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763965#M470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;why does under 1.5 i now get this keyerror for opedrational layers. I'm using the same code and loading in the same webmap json from file. But the dictionary does not contain any operationallayer keys after the json file has been loaded in. what changed at 1.5?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for subdir, dirs, files in os.walk(rootdir3):&lt;BR /&gt; for file in files:&lt;BR /&gt; #print (os.path.join(subdir, file))&lt;BR /&gt; print("processing: " + file)&lt;BR /&gt; &lt;BR /&gt; #modify existing web map&lt;BR /&gt; web_map_json = str()&lt;/P&gt;&lt;P&gt;# read a previously downloaded and saved web map json from text file&lt;BR /&gt; # store each template json file in a seperate folder from the gdb files. Loop through all the templates in each country&lt;BR /&gt; with open(os.path.join(subdir, file),"r") as file_handle:&lt;BR /&gt; web_map_json = json.load(file_handle)&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; # publish a new web map setting some attributes and using the json as input&lt;BR /&gt; # will need a title and snippet for each country to be somewhere in a list&lt;BR /&gt; web_map_item_properties = {'title':file[:-5],&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'type':'Web Map',&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'snippet':'This map shows a Template Map',&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'tags':'ArcGIS Python API',&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'text':json.dumps(web_map_json)}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# add to the portal&lt;BR /&gt; web_map_item = gis.content.add(web_map_item_properties)&lt;BR /&gt; &lt;BR /&gt; # create a web map object out of the item&lt;BR /&gt; web_map_obj = arcgis.mapping.WebMap(web_map_item)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;layer_list = web_map_obj['operationalLayers']&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***get KeyError for above line&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Sep 2018 00:10:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763965#M470</guid>
      <dc:creator>AlistairFox</dc:creator>
      <dc:date>2018-09-09T00:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: KeyError in Creating Web Map Inventory</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763966#M471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Even using 1.4.x, I never got the approach of &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;web_map_obj['opertionalLayers']&lt;/SPAN&gt; to work, which is why I posted two alternative methods to access the operational layers. The current &lt;A class="link-titled" href="https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.mapping.html#webmap" title="https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.mapping.html#webmap"&gt;arcgis.mapping module — arcgis 1.5.0 documentation&lt;/A&gt; for WebMap states operational layers should be accessed via the layers property (option #1 that I posted):&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;CODE class="" style="box-sizing: border-box; font-family: Consolas, 'Andale Mono WT', 'Andale Mono', 'Lucida Console', 'Lucida Sans Typewriter', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Liberation Mono', 'Nimbus Mono L', Monaco, 'Courier New', Courier, monospace; font-size: 14.4px; white-space: nowrap; max-width: 100%; background: transparent; border: none; padding: 0px; color: #000000; overflow-x: auto; font-weight: bold;"&gt;layers&lt;/CODE&gt;&lt;/P&gt;&lt;P style="box-sizing: border-box; line-height: 24px; font-size: 16px; margin: 0px 0px 12px !important 0px;"&gt;Operational layers in the web map :return: List of Layers as dictionaries&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Sep 2018 14:45:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-in-creating-web-map-inventory/m-p/763966#M471</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-09-09T14:45:34Z</dc:date>
    </item>
  </channel>
</rss>

