Attempting to run one of Dublin, OH's useful Assessment Notebooks.
Was already informed by the Error Text that gis.content.add() has been deprecated, and that I must use the Folder.add() class/method to add X item to an ArcGIS Online Folder that gets to be specified by me.
So I attempted to set the specified folder, but am admonished:
AttributeError: 'ContentManager' object has no attribute 'folders'
Despite the Documentation telling me otherwise:
https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#folder
# Usage Example:
>>> from arcgis.gis import GIS, ItemProperties, ItemTypeEnum
>>> gis = GIS(profile="your_organization_profile")
>>> data_path = r"<path_to_zipped_shapefile>"
>>> item_props = ItemProperties(title="new_shapefile_item",
item_type=ItemTypeEnum.SHAPEFILE.value,
tags="new_shp_item,from_api",
snippet="Demo item added from Python API")
>>> folders_obj = gis.content.folders
>>> item_folder = folders_obj.get(folder="water_data")
>>> add_job = item_folder.add(item_properties=item_props,
file=data_path)
>>> if not add_job.done():
>>> print("...job precessing...")
>>> else:
>>> new_shp_item = add_job.result()
>>> new_flyr_item = new_shp_item.publish()I did find this User on GitHub with the same issue, but their solution (upgrading ArcGIS Pro to 3.4) is not a viable option for me: ContentManager.folders does not work as documented · Issue #2268 · Esri/arcgis-python-api
I can barely follow the script I'm trying to triage as it is. I'm not a developer. But any offered solution would be appreciated --just know that I may not understand complexities beyond adding/substituting lines of python in the Notebook I'm following.