I've been working through this post to try to download/backup my feature hosted layer(s) to gdb onto my local machine from ArcGIS Online using Notebook but it is not working. I can easily create a backup in a user's/my contents online but it does not work when I try and download the files to my desktop or similar.
My code is below (excluding personal info) - it doesn't error it just doesn't really do anything?! I'm very very new to this so appreciate its a bit clunky. Any tips greatly appreciated!
#import modules
from arcgis.gis import GIS
from arcgis.features import manage_data
import time, os, fnmatch, shutil
from pathlib import Path
gis = GIS(username="Username", password="Password")
item_id = 'itemid'
data_item = gis.content.get(item_id)
data_item
data_item.title
fgdb_title = data_item.title
t = time.localtime()
timestamp = time.strftime('%d%b%Y_%H%M',t)
result = data_item.export(fgdb_title + ' ' + timestamp, "File Geodatabase")
result
data_path = Path(r'C:\Users\name\Desktop\backup')
if not data_path.exists():
data_path.mkdir()
extract_path = data_path.joinpath('export')
result.download(save_path=data_path)
result.download