AnsweredAssumed Answered

Download Zipped File Geodatabase on ArcGIS Online through API

Question asked by deleted-user-iWc3EQwf6ke7 on Apr 19, 2018
Latest reply on Nov 15, 2018 by friendde

Hi folks,


I was trying to download a hosted feature layer by using the ArcGIS Python API.


The workflow I followed is to export the layer as a file geodatabase first, then search for its itemID by using '' and finally using the 'get_data()' to download the FGB to the temp file path.


However, the problem is that the script is not stable (I think it may be a bug) because with the exact code, sometime it would download the exported FGB with only 1 KB in size, while the rest of time it would download FGB with the correct size. I cannot find the problem because everything seems work perfectly when I test the code out in Jupyter Notebook, until the very last step where I try to download the exported FGB.


Any help would be appreciated! 


The followings are a subset of my script:


anno_gis = GIS(url, user_name, password)
wildlife = anno_gis.content.get(item_id)
tod_date =
date = tod_date.strftime('%Y%m%d')
title = "Wildlife_FGB_" + date
wildlife.export(title,'File Geodatabase', parameters=None, wait='True')
search_fgb = = "title:{}*".format("Wildlife_FGB_" + date))

fgb_item_id = search_fgb[0].id 
fgb = anno_gis.content.get(fgb_item_id)
temp_fgb= fgb.get_data()