You would use the REST API query. Here's some sample code which you will need to modify.
import arcpy, urllib, urllib2, json, sys, time, datetime, collections
from datetime import datetime, timedelta
H = 220
date_H_hours_ago = datetime.now() - timedelta(hours=H)
username = 'Username'
password = 'Password'
URL = "https://services2.arcgis.com/somestring/arcgis/rest/services/FeatureName/FeatureServer/0/query"
referer = "http://www.arcgis.com/"
tokenurl = "https://www.arcgis.com/sharing/rest/generateToken"
query_dict = { 'username': username, 'password': password, 'referer': referer }
query_string = urllib.urlencode(query_dict)
token = json.loads(urllib.urlopen(tokenurl + "?f=json", query_string).read())
if "token" not in token:
print(token['error'])
sys.exit(1)
query_dict = {
"where" : "EditDate >= DATE '2016-06-01 00:00:00'",
"outFields" : "OBJECTID, EditDate",
"orderByFields" : "EditDate",
"returnGeometry" : "true",
"f": "json", "token": token['token'] }
jsonResponse = urllib.urlopen(URL, urllib.urlencode(query_dict))
features = json.loads(jsonResponse.read(),
object_pairs_hook=collections.OrderedDict)[u'features']
print '\n\nTitle if needed:'
print 'ObjectID\tEditDate\tX-lon\tY-lat'
for feature in features:
editTime = time.strftime('%c', time.localtime(feature['attributes']['EditDate']/1000))
print str(feature['attributes']['OBJECTID']) + '\t' + editTime,
ptGeometry = arcpy.PointGeometry(arcpy.Point(feature['geometry']['x'],feature['geometry']['y']),
arcpy.SpatialReference(3857)).projectAs(arcpy.SpatialReference(4326))
print "\t" + str(ptGeometry.firstPoint.X) +"\t" + str(ptGeometry.firstPoint.Y)
Some of the places you need to change are lines: 12, 13, 16, 32, 53, 54, 61. There's also some general notes and debugging code, which you can cut out.