I am curious if it is possible to update a widget parameter/config for a Web App with the ArcGIS API for Python? I am able to successfully access and view the web app item's data, but I am unclear as to how I update the Web App item data.
I am downloading the JSON, modifying the widget parameter, and trying to update the item with the modified JSON (code below), but I get the error: ValueError: stat: path too long for Windows
item_data <SPAN class="operator token">=</SPAN> webApp_item<SPAN class="punctuation token">.</SPAN>get_data<SPAN class="punctuation token">(</SPAN>try_json<SPAN class="operator token">=</SPAN><SPAN class="token boolean">True</SPAN><SPAN class="punctuation token">)</SPAN>
dataDumps <SPAN class="operator token">=</SPAN> json<SPAN class="punctuation token">.</SPAN>dumps<SPAN class="punctuation token">(</SPAN>item_data<SPAN class="punctuation token">)</SPAN>
webapp_json_as_dict <SPAN class="operator token">=</SPAN> json<SPAN class="punctuation token">.</SPAN>loads<SPAN class="punctuation token">(</SPAN>dataDumps<SPAN class="punctuation token">)</SPAN>
widgets<SPAN class="operator token">=</SPAN> webapp_json_as_dict<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'widgetPool'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">'widgets'</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="keyword token">for</SPAN> widget <SPAN class="keyword token">in</SPAN> widgets<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">if</SPAN> widget<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'name'</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">==</SPAN> <SPAN class="string token">'Geoprocessing'</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">for</SPAN> param <SPAN class="keyword token">in</SPAN> widget<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'config'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">'inputParams'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">if</SPAN> param<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'name'</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">==</SPAN> <SPAN class="string token">'Project_ID'</SPAN><SPAN class="punctuation token">:</SPAN>
test <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">'ID_420751'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'ID_664616'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'ID_664616'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'TEST'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'TEST2'</SPAN><SPAN class="punctuation token">]</SPAN>
param<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'choiceList'</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> test
jsonUpdate <SPAN class="operator token">=</SPAN> json<SPAN class="punctuation token">.</SPAN>dumps<SPAN class="punctuation token">(</SPAN>webapp_json_as_dict<SPAN class="punctuation token">)</SPAN>
webApp_item<SPAN class="punctuation token">.</SPAN>update<SPAN class="punctuation token">(</SPAN>data<SPAN class="operator token">=</SPAN>jsonUpdate<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Any help would be greatly appreciated!