Excellent work! This is just what I needed!
Some modifications I had to make to Treg's code in order to get this to work, since it seems Python 3.x handles some things differently:
I had to import http.client instead of httplib
I had to use 'params = urllib.parse.urlencode(...' instead of 'params = urllib.urlencode(...'
I am using a web adaptor, so I left the PORT null, and just changed the tokenURL
Other than that, this worked! Now I just need to figure out how to push edits/additions back up to the feature service via arcpy...