I have an existing project that has a few media files. I have frequent updates to these media files as well as occasional form updates. I need a python script that I can run via scheduler that will publish this project nightly. I have read a bunch of posts but cant find anything clearly stated that shows how to do this. Is there anyone out there that can help provide a solution?
I found this https://www.arcgis.com/home/item.html?id=521168944ace40d0827991eeeba03689
I am just trying to figure out what is happening....I dont even know if I can still use this as its from 2017 !!
I'm really confused as to what is going on....I assume that I can use this to update my media files daily if need be.
What is the ago.AGOLHelper
I know I have the correct UserName and Password but I am getting a NULL for the agol_helper.token
agol_helper.token = NULL
agol_helper = ago.AGOLHelper(portal_url) print ("...Authenticating") # login agol_helper.login(credentials['userName'], credentials['passWord']) print ("...Querying") # get the name of the zip file serviceInfo = getServiceDefinition(agol_helper.token, itemID)
There is a new way now using Linked Content. But it may have some issues it looks like. See this post https://community.esri.com/t5/arcgis-survey123-questions/auto-update-select-one-from-file-list-and-the/m-p/1045109
The other new way to to link to a feature service but that would require being online. It is in the early adopter only for now.
Hope that helps
There are other things my lists do as in prepopulate etc....
I am looking for an automated process that I can replace the Media Files at will and then automatically republish the project nightly. Preferable from Python script.
You can link all your lists to a stand alone CSV that you store in AGOL. Works just like the media folder but no need to republish. Then you use Python to update that item. The form then sees this change and updates. Check out select_one_from_file.
So right now I have 4 media files. The excel file points to them.
Are there any examples of how to update these tables via python?
@jaykapalczynski I still regularly use @Anonymous User 's script provided in this blog. You have to save the python2.7 script in the "download_folder" and you won't get the zip message error anymore.
Hi @JamesKelly4 @jaykapalczynski @DougBrowning ,
Note that @ZacharySutherby has provided an updated copy of the script using Python 3 and some other improvements. See this comment here: https://community.esri.com/t5/arcgis-survey123-questions/updating-csvs-in-agol-for-select-one-from-file-and/m-p/1016256/highlight/true#M31917
Regards,
Phil.
What zip file? I have to create a Zip file everytime?
Hi @jaykapalczynski,
If you are using either of the python scripts that are linked to the above comments to update CSV files or other media files, it downloads the Form item (which is a zip file), extracts it, you then update the items, and the script then re-creates the zip file again, and uploads its.
Note that this process does not update the XLSForm itself, the only way to do that is via publishing the survey again via Connect, as the xlsx file has to be converted to xml and other form item information updated. The script can only be used to update media files without publishing.
Im confused....I know I have the correct Credentials but keep getting coming up with a NULL for the token I am trying to get via the script.
This returns NULL...any thoughts
print "token: " + json.dumps(agol_helper.token)
NOTE: I have ArcMap 10.8.1 installed. I have python 2.7 and python 3.4 on my machine. Could this be causing the issue? If so is there a way that I can specify to use python 2.7?
It appears I am using 2.7.18
print ("...Starting") # initialize the portal helper class # ago.py is part of the 10.3 python install agol_helper = ago.AGOLHelper(portal_url) print portal_url print ("...Authenticating") # login print credentials['userName'] print credentials['passWord'] agol_helper.login(credentials['userName'], credentials['passWord']) print "token: " + json.dumps(agol_helper.token) print ("...Querying") # get the name of the zip file serviceInfo = getServiceDefinition(agol_helper.token, itemID)
Noting that I updated the "portal_url" parameter for my AGOL online account....line 11
# User Parameters # ItemID of the Form item you want to update itemID = "00da9adCr45f4f15b3443ecadd81vfgh" # Local folder where the Form data will be downloaded (include a / at end of path) download_folder = "C:/Users/tjv34534/Desktop/CWD_Project/Update_Media_Folder/" # Updated file name (ie MyList.csv) updated_file = "CheckQuery.csv" # Folder path of the updated file (include a / at end of path) source_loc = "C:/Users/tjv34534/Desktop/CWD_Project/Update_Media_Folder/UpdatedMediaFiles/" # Address of your ArcGIS portal portal_url = r"https://xyz.maps.arcgis.com/" # ArcGIS user credentials to authenicate against the portal (case sensitive) credentials = {'userName' : 'xyz', 'passWord' : 'xyz'} # ArcGIS portal security type (LDAP, NTLM, OAuth, Portal, PKI) security_type = "Portal"
As @ZacharySutherby points out in this post here and I mentioned in one of my comments above, the original update media folder script is now outdated and contains modules that have been superseded by the ArcGIS API for Python.
We have updated this script to use the ArcGIS API for python and the updated script is present in our Survey123-tools github repo.
OK I think I have this working from ArcGIS Pro on my Laptop....it appears to be updating and uploading this to AGOL.
Most Important
How do I automate it to run when I want it to. I am new to using Pro and it appears to be baked into an ArcGIS Pro project?????
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.