I am trying to create a python script (in rest API for Python) to make a replica of a feature layer view and then append the data into a hosted feature layer. This script is meant to run once a day to keep a record of that day's changes for a time enabled application and general record of changes. This view layer is a one-to-one point join layer and has added statistics and that statistic field is the important field. My colleague and I managed tinker with a detect edits script from Esri to pull the data from the hosted view (with a json file that helps build the REST URL). The script pulled the data correctly, however, the script just prints the data into the console as seen here:
My thoughts on how I can get the data from the feature layer view to the log HFL are somehow taking the output here and appending the data to the log file, or changing the output from this print to create a file geodatabase or shapefile, then appending that and deleting the temporary gdb/shp. Either way, I don't know enough about Python to do these so I am looking for some guidance on how I might be able to accomplish this.
I attached the code and its json file below. NOTE the code needs the Json file in the same folder as the .py file and needs an AGOL username and password to run. The feature layers are public and are a sandbox/ exercise version of the layers for my client. Any assistance would be appreciated. Thanks!