I am trying to add a FeatureService to a folder in ArcGIS Online using the Python APIs Folder.add() method.
This method returns a Future. How can I wait for this to finish and execute the remainder of the script synchronously? The only way I found was with a while loop, which is not nice.
item_properties = {
"title": "Test Feature Service",
"tags": "example, feature service",
"type": "File Geodatabase",
}
gdb_path = r"Default.gdb.zip"
folder = login.content.folders.get(folder="My_Folder", owner="my-username")
add_job = folder.add(item_properties, gdb_path)
while True:
if add_job.done():
result = add_job.result()
break
print(result)