Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
else:
del feature['attributes'][attribute]
#Remove non matching fields from features to reduce payload being sent in 'edit_features' (adding new features) call
for feature in features:
for attribute in list(feature['attributes']):
if attribute not in matchfieldnames:
del feature['attributes'][attribute]
#Create ArcGIS Python API Features List
fset = []
for feature in features:
tempFeature = Feature(feature['geometry'], feature['attributes'])
fset.append(tempFeature)
#Convert all date values to UTC for records to add
for feature in fset:
for dateField in dateFields:
if feature.get_value(dateField):
if isinstance(feature.get_value(dateField), int):
fcTime = int(feature.get_value(dateField)/1000)
try:
dateValue = dt.utcfromtimestamp(fcTime)
except (OSError, OverflowError):
dateValue = dt(1970,1,1,0) + td(seconds=fcTime)
else:
dateValue = dt.strptime(feature.get_value(dateField), timestamp)
try:
dateValue = int(dateValue.timestamp()*1000)