Select to view content in your preferred language

Python Script to Auto update Web Map from Arc Pro project

110
1
yesterday
ShareUser
Esri Community Manager

I would like to create a python Script to automatically update my web map from my ArcPro project.

I have a ArcPro project that I manually update the web map right now.

I also used experience builder to create a user-friendly web map that uses the data from my published web map.

I have attached my first try at a script, but it doesn't work. Any help on how to fix the script would be appreciated.

0 Kudos
1 Reply
ShareUser
Esri Community Manager

Try arcpy.server.UploadServiceDefinition(sd, portal_url)

Double check you are signed in

print(arcpy.GetActivePortalURL())

Change raise Exception(f"Map '{map_name}' not found.")

to

sddraft = os.path.join(sharing_draft_folder, f"{service_name}.sddraft")
sd = os.path.join(sharing_draft_folder, f"{service_name}.sd")

print(f"{service_name} published successfully!")

 

And for the Exception try,

except Exception:
print("Publishing failed.")
print(arcpy.GetMessages(0))
print(arcpy.GetMessages(1))
print(arcpy.GetMessages(2))
raise

0 Kudos