<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Update Feature Layer in AGOL in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/update-feature-layer-in-agol/m-p/520829#M40831</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to use arcrest python tools to update a feature layer in AGOL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the Delete_Append.py script, which comes from the arcrest download, that I am running:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#&amp;nbsp; &lt;BR /&gt;# Deletes all rows from feature layer&amp;nbsp; &lt;BR /&gt;# Adds rows from local feature class&amp;nbsp; &lt;BR /&gt;# to a hosted feature service&amp;nbsp; &lt;BR /&gt;#&amp;nbsp; &lt;/P&gt;&lt;P&gt;import gc&lt;BR /&gt;import os&lt;BR /&gt;import sys&lt;BR /&gt;import arcpy&lt;BR /&gt;import arcrest&lt;BR /&gt;import arcresthelper&lt;/P&gt;&lt;P&gt;from arcresthelper import featureservicetools&lt;BR /&gt;from arcresthelper import common&lt;BR /&gt;from arcrest import agol&lt;BR /&gt;from arcrest import hostedservice&lt;/P&gt;&lt;P&gt;try:&amp;nbsp; &lt;/P&gt;&lt;P&gt; url = "&lt;A href="http://services.arcgis.com/G4Sghs7PIgYd6Y/arcgis/rest/services/GIS/FeatureServer/0"&gt;http://services.arcgis.com/G4Sghs7PIgYd6Y/arcgis/rest/services/GIS/FeatureServer/0&lt;/A&gt;"&lt;BR /&gt; ag_username = "user"&lt;BR /&gt; ag_password = "pass"&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt; fl = arcrest.agol.layer.FeatureLayer(url=url,username=username,password=password)&lt;BR /&gt; print fl.deleteFeatures(where="1=1")&amp;nbsp; &lt;BR /&gt; print 'all features removed'&amp;nbsp; &lt;BR /&gt;&amp;nbsp; &lt;BR /&gt; fc = r"C:\dept\GIS\max\max.gdb\Parcels"&amp;nbsp; &lt;BR /&gt;&amp;nbsp; &lt;BR /&gt; features = arcrest.agol.common.Feature.fc_to_features(fc)&amp;nbsp; &lt;BR /&gt; print fl.addFeature(features=features)&amp;nbsp; &lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;except ValueError, e:&amp;nbsp; &lt;BR /&gt; print e&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, I am getting the following error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TypeError: __init__() got an unexpected keyword argument 'username'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp; Anyone have any idea(s) why this error is being thrown.&amp;nbsp; I am running this script with ArcMap 10.2.0 and python 2.7.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Jul 2015 16:15:08 GMT</pubDate>
    <dc:creator>MichaelVolz</dc:creator>
    <dc:date>2015-07-17T16:15:08Z</dc:date>
    <item>
      <title>Update Feature Layer in AGOL</title>
      <link>https://community.esri.com/t5/python-questions/update-feature-layer-in-agol/m-p/520829#M40831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to use arcrest python tools to update a feature layer in AGOL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the Delete_Append.py script, which comes from the arcrest download, that I am running:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#&amp;nbsp; &lt;BR /&gt;# Deletes all rows from feature layer&amp;nbsp; &lt;BR /&gt;# Adds rows from local feature class&amp;nbsp; &lt;BR /&gt;# to a hosted feature service&amp;nbsp; &lt;BR /&gt;#&amp;nbsp; &lt;/P&gt;&lt;P&gt;import gc&lt;BR /&gt;import os&lt;BR /&gt;import sys&lt;BR /&gt;import arcpy&lt;BR /&gt;import arcrest&lt;BR /&gt;import arcresthelper&lt;/P&gt;&lt;P&gt;from arcresthelper import featureservicetools&lt;BR /&gt;from arcresthelper import common&lt;BR /&gt;from arcrest import agol&lt;BR /&gt;from arcrest import hostedservice&lt;/P&gt;&lt;P&gt;try:&amp;nbsp; &lt;/P&gt;&lt;P&gt; url = "&lt;A href="http://services.arcgis.com/G4Sghs7PIgYd6Y/arcgis/rest/services/GIS/FeatureServer/0"&gt;http://services.arcgis.com/G4Sghs7PIgYd6Y/arcgis/rest/services/GIS/FeatureServer/0&lt;/A&gt;"&lt;BR /&gt; ag_username = "user"&lt;BR /&gt; ag_password = "pass"&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt; fl = arcrest.agol.layer.FeatureLayer(url=url,username=username,password=password)&lt;BR /&gt; print fl.deleteFeatures(where="1=1")&amp;nbsp; &lt;BR /&gt; print 'all features removed'&amp;nbsp; &lt;BR /&gt;&amp;nbsp; &lt;BR /&gt; fc = r"C:\dept\GIS\max\max.gdb\Parcels"&amp;nbsp; &lt;BR /&gt;&amp;nbsp; &lt;BR /&gt; features = arcrest.agol.common.Feature.fc_to_features(fc)&amp;nbsp; &lt;BR /&gt; print fl.addFeature(features=features)&amp;nbsp; &lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;except ValueError, e:&amp;nbsp; &lt;BR /&gt; print e&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, I am getting the following error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TypeError: __init__() got an unexpected keyword argument 'username'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp; Anyone have any idea(s) why this error is being thrown.&amp;nbsp; I am running this script with ArcMap 10.2.0 and python 2.7.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 16:15:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-feature-layer-in-agol/m-p/520829#M40831</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2015-07-17T16:15:08Z</dc:date>
    </item>
  </channel>
</rss>

