Due to a server migration, I need to update all the service URLs to the new server. The script runs, however, I do not see the update for the layers in the web map.
I took a look at this and attempted to implement but still no update.
Could someone please assist. Posted code below
from arcgis.mapping import WebMap
if __name__ == "__main__":
user = gis.users.get(UN)
print ("Successfully Logged in as " + user['username'])
webMapID = "036292a6eb7b4bdFakeWEBMAP"
print ("Gaining attributes for web map: " + str(webMapID))
Webmap = gis.content.get(str(webMapID))
wm = WebMap(Webmap)
loop = 0
for layer in wm.layers:
upd = layer
if gisenturl in layer['url']:
wm.layers[loop]['url'] = layer['url'].replace(gisenturl,gisviewurl)
print ("Service Updated for " + layer['title'])
loop += 1