The last couple of months have been an education. Developing -amongst others- a way to backup our online data including attachments. I didn't know much about python, not much about agol and I barely had heard about REST. I want to share my solution here because I hope people can benefit from it. Everything you need to fill in yourself starts with 'my_'
The attachend script scans through the arcgis online hosted feature services, then exports and downloads a zipped file geodatabase per layer containing attachments if attachments are present.
I'm very happy with that because my basic arcmap license doesn't allow me to connect to agol and make a 'local copy for editing' when attachements are present. Also this script works when our licensemanager is offline or depleted.
It is based on work from Jake Skinner and Andrew Chapowski; Thanks Jake and thanks Andrew!.
It's not a neat script although I use comments to explain a bit and there is a logfile of sorts. It's not 'pythonesque', 'pythonese', 'oop' or whatever. I feel more comfortable using IF: than TRY: I use way to many modules, so I'm sure real developers out there can rewrite the script to half it's current size while outperforming this 10 to 1
I've been struggling with getting through our companies proxy and at the moment I am still not able to get the second part working over a proxy, without a proxy all is fine. Our IT has come my way and later this week I'll get a firewall rule and the script will run without a proxy. (thank you IT guys!)
So, have fun! Should you have any questions feel free to ask.