AnsweredAssumed Answered

Update Feature Layer in AGOL

Question asked by mvolz47 on Jul 17, 2015

I am trying to use arcrest python tools to update a feature layer in AGOL.

 

 

 

Below is the Delete_Append.py script, which comes from the arcrest download, that I am running:

 

 

 


# Deletes all rows from feature layer 
# Adds rows from local feature class 
# to a hosted feature service 

import gc
import os
import sys
import arcpy
import arcrest
import arcresthelper

from arcresthelper import featureservicetools
from arcresthelper import common
from arcrest import agol
from arcrest import hostedservice

try: 

url = "http://services.arcgis.com/G4Sghs7PIgYd6Y/arcgis/rest/services/GIS/FeatureServer/0"
ag_username = "user"
ag_password = "pass"
 
fl = arcrest.agol.layer.FeatureLayer(url=url,username=username,password=password)
print fl.deleteFeatures(where="1=1") 
print 'all features removed' 
 
fc = r"C:\dept\GIS\max\max.gdb\Parcels" 
 
features = arcrest.agol.common.Feature.fc_to_features(fc) 
print fl.addFeature(features=features) 
 
except ValueError, e: 
print e

 

 

Unfortunately, I am getting the following error:

 

TypeError: __init__() got an unexpected keyword argument 'username'

 

 

 

I don't understand why I am getting this error and I am using the code exactly from the sample just changing the username for my environment.  Anyone have any idea(s) why this error is being thrown.  I am running this script with ArcMap 10.2.0 and python 2.7.

Outcomes