from arcgis.gis import GIS
from IPython.display import display
gis = GIS("portal url", 'username', 'password')
#search for the feature layer named Ports along west coast
search_result = gis.content.search('title:Ports along west coast')
#access the item's feature layers
ports_item = search_result[0]
ports_layers = ports_item.layers
#query all the features and display it on a map
ports_fset = ports_layers[0].query() #an empty query string will return all
ports_flayer = ports_layers[0]
ports_features = ports_fset.features
# select San Francisco feature
sfo_feature = [f for f in ports_features if f.attributes['port_name']=='SAN FRANCISCO'][0]
sfo_feature.attributes
try:
update_result = ports_flayer.edit_features(updates=[sfo_edit])
except:
pass
This is the example that I have shown in which I am trying to update feature layer. Actually I am updating the records in a loop so there are many records. The problem is in the case "Internet Connection" is just shot down It get stuck to the function edit_features.
So there is no way It could go to except and continue the flow.
I just have to ctrl+c to stop script execution because it got hanged and edit_features() function. What can I do?