Esri / ArcREST

python package for REST API (AGS, AGOL, webmap JSON, etc..)
Apache License 2.0
192 stars 155 forks source link

Need Assistance with "adds_rows_to_service.py" sample script #222

Closed RandySincoular closed 8 years ago

RandySincoular commented 8 years ago

I have a feature layer in AGOL called: AEOutageData2. The layer name is called: OutageEvent. Layer: OutageEvent (ID:0).

It's ID is 0. I am trying to get the 'adds_rows_to_service.py' sample working so I can eventually remove rows/records from this feature layer and add new ones.

I have tried using the REST endpoint of the feature layer and just the name of the feature layer and they do not work. The script does not error out, it just runs and ends.

When the script gets to the following line 'if not fs is None:', the value of 'fs is of Type "NoneType" and the value is "None". So, that tells me I don't have the layer referenced incorrectly.

Does anyone have any ideas or a sample of how to reference the layername correctly?

The output from the script is:

* Remote Interpreter Reinitialized *

Calling featureservicetools get feature service just checked 'fs'

""" This sample shows how to delete rows from a layer version 3.0.1 Python 2 """ import arcrest from arcresthelper import featureservicetools from arcresthelper import common

def trace(): """ trace finds the line, the filename and error message and returns it to the user """ import traceback, inspect,sys tb = sys.exc_info()[2] tbinfo = traceback.format_tb(tb)[0] filename = inspect.getfile(inspect.currentframe())

script name + line number

line = tbinfo.split(", ")[1]
# Get Python syntax error
#
synerror = traceback.format_exc().splitlines()[-1]
return line, filename, synerror

def main(): proxy_port = 80 proxy_url = 'msn-proxy.xxxxxxx'

securityinfo = {}
securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI
securityinfo['username'] = "Randyxxxxxx"#<UserName>
securityinfo['password'] = "xxxxxx"#<Password>
securityinfo['org_url'] = "http://www.arcgis.com"
securityinfo['proxy_url'] = proxy_url
securityinfo['proxy_port'] = proxy_port
securityinfo['referer_url'] = None
securityinfo['token_url'] = None
securityinfo['certificatefile'] = None
securityinfo['keyfile'] = None
securityinfo['client_id'] = None
securityinfo['secret_id'] = None

itemId = "0"#<Item ID>

# AGOL Layer Name
layerName = "http://services3.arcgis.com/sqVn1QnQEPnGQy9r/arcgis/rest/services/AEOutageData2/FeatureServer/0" #layer1

# Path to Local FGDB Featureclass on PC
pathToFeatureClass = r"C:\gis\AEOutageData2.gdb\OutageEvent"

try:

    print("Calling featureservicetools")
    fst = featureservicetools.featureservicetools(securityinfo)
    if fst.valid == False:
        print fst.message
    else:

        print("get feature service")
        fs = fst.GetFeatureService(itemId=itemId,returnURLOnly=False)

* the variable 'fs' is set to a value = 'None' when it gets here* if not fs is None:

            print "fs is Not None"

            fs_url = fst.GetLayerFromFeatureService(fs=fs,layerName=layerName,returnURLOnly=True)

            print "%s url" + fs_url

            if not fs_url is None:
                print " fs_url is None"

                results =  fst.AddFeaturesToFeatureLayer(url=fs_url, pathToFeatureClass=pathToFeatureClass,
                                                  chunksize=2000)
                if 'addResults' in results:
                    print "%s features processed" % len(results['addResults'])

        print "just checked 'fs'"

except (common.ArcRestHelperError),e:
    print "error in function: %s" % e[0]['function']
    print "error on line: %s" % e[0]['line']
    print "error in file name: %s" % e[0]['filename']
    print "with error message: %s" % e[0]['synerror']
    if 'arcpyError' in e[0]:
        print "with arcpy message: %s" % e[0]['arcpyError']

except:
    line, filename, synerror = trace()
    print "error on line: %s" % line
    print "error in file name: %s" % filename
    print "with error message: %s" % synerror

if name == "main": main()

MikeMillerGIS commented 8 years ago

Your URL is incorrect. That url is for a feature layer, not a feature service. Change http://services3.arcgis.com/sqVn1QnQEPnGQy9r/arcgis/rest/services/AEOutageData2/FeatureServer/0 to http://services3.arcgis.com/sqVn1QnQEPnGQy9r/arcgis/rest/services/AEOutageData2/FeatureServer

RandySincoular commented 8 years ago

Hi Mike – I tried that and get the same result as before. The variable ‘fs’ is still ‘None’.

Thanks,

Randy

From: Michael Miller [mailto:notifications@github.com] Sent: Wednesday, April 20, 2016 7:37 AM To: Esri/ArcREST Cc: Sincoular, Randy; Author Subject: Re: [Esri/ArcREST] Need Assistance with "adds_rows_to_service.py" sample script (#222)

Your URL is incorrect. That url is for a feature layer, not a feature service. Change http://services3.arcgis.com/sqVn1QnQEPnGQy9r/arcgis/rest/services/AEOutageData2/FeatureServer/0 to http://services3.arcgis.com/sqVn1QnQEPnGQy9r/arcgis/rest/services/AEOutageData2/FeatureServer

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_Esri_ArcREST_issues_222-23issuecomment-2D212406434&d=CwMCaQ&c=GUDVeAVg1gjs_GJkmwL1m3gEzDND7NeJG5BIAX_2yRE&r=VPwuEa_rNmp_UVm0od-YvdtKnlNWqqwbpxa2Pz1fNVE&m=ElzG_fkB8zC9cmFtF32yzPb1E2kNtauryhkT6k-VaGc&s=U7P2f8xWqsq2qFZeLMbT4dT3PMt_3hfqUxMFB9PhVJQ&e=

MikeMillerGIS commented 8 years ago

Oh, layer name is the name of the layer, not the url. Also, your item id 0, you need to use the ID of the portal item. Why are you using this sample if you have the URL.

You just need to pass the URL into fst.AddFeaturesToFeatureLayer(url=FEATURE LAYER URL, pathToFeatureClass=pathToFeatureClass, chunksize=2000)

RandySincoular commented 8 years ago

Hi Mike – ok, here is what I have tried. I get the same results. I am using the ID from the SERVICE URL.

The reason I picked this sample is because it was close to what I wanted to accomplish. I didn’t see any other samples for calling “AddFeaturesToFeatureLayer”. Do you happen to have a sample script that calls the ‘AddFeaturesToFeatureLayer’ for a jumpstart?

itemId = "sqVn1QnQEPnGQy9r"#<Item ID>

# AGOL Layer Name
# This syntax does not work
# layerName = "http://services3.arcgis.com/sqVn1QnQEPnGQy9r/arcgis/rest/services/AEOutageData2/FeatureServer/0" #layer1

# this syntax does not work
# layerName = "http://services3.arcgis.com/sqVn1QnQEPnGQy9r/arcgis/rest/services/AEOutageData2/FeatureServer"

# this does not work
layerName = "OutageEvent"

# this does not work
layerName = "AEOutageData2"

# Path to Local FGDB Featureclass on PC
pathToFeatureClass = r"C:\gis\AEOutageData2.gdb\OutageEvent"

thanks,

Randy From: Michael Miller [mailto:notifications@github.com] Sent: Wednesday, April 20, 2016 7:46 AM To: Esri/ArcREST Cc: Sincoular, Randy; Author Subject: Re: [Esri/ArcREST] Need Assistance with "adds_rows_to_service.py" sample script (#222)

Oh, layer name is the name of the layer, not the url. Also, your item id 0, you need to use the ID of the portal item. Why are you using this sample if you have the URL.

You just need to pass the URL into fst.AddFeaturesToFeatureLayer(url=, pathToFeatureClass=pathToFeatureClass, chunksize=2000)

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_Esri_ArcREST_issues_222-23issuecomment-2D212409223&d=CwMCaQ&c=GUDVeAVg1gjs_GJkmwL1m3gEzDND7NeJG5BIAX_2yRE&r=VPwuEa_rNmp_UVm0od-YvdtKnlNWqqwbpxa2Pz1fNVE&m=zoxmPOVTZ1g2tFI1ElgWW6i5r31JJk44dHdFKq-dRiU&s=kvmp0LDK4HQKDuapMRzb5QqSF-jZvKe5Pw3fYVfG_TU&e=

MikeMillerGIS commented 8 years ago

Randy, That is not the item id, that is the org id. The item id is the id in the url when you are looking at the item in the browser. Not the rest url of the service.

All you need to do it this:

fst = featureservicetools.featureservicetools(securityinfo) if fst.valid == False: print fst.message else: results = fst.AddFeaturesToFeatureLayer(url=your url to the feature layer, pathToFeatureClass=pathToFeatureClass, chunksize=2000)

RandySincoular commented 8 years ago

Hi Mike – I appreciate your help and patience troubleshooting this.

I modified the script using your sample. It looks like it gets to the point of reading records from my local FGDB – it only has 1 record. Then it sits for a little bit and comes back with the error message.

Are there any limitations to the FGDB? The FGDB has the following fields: OBJECTID, SHAPE, DMS_BEGIN_TIME, NUM_CUST_OUT The AGOL feature layer has the following fields: OBJECTID, DMS_BEGIN_TIME, NUM_CUST_OUT

Output * Remote Interpreter Reinitialized *

calling AddFeatures ... 1 features in layer error in function: AddFeaturesToFeatureLayer error on line: line 510 error in file name: C:\Python27\ArcGIS10.2\lib\site-packages\arcresthelper\featureservicetools.py with error message: URLError: <urlopen error [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>

Modified Script

import arcrest from arcresthelper import featureservicetools from arcresthelper import common

def trace(): """ trace finds the line, the filename and error message and returns it to the user """ import traceback, inspect,sys tb = sys.exc_info()[2] tbinfo = traceback.format_tb(tb)[0] filename = inspect.getfile(inspect.currentframe())

script name + line number

line = tbinfo.split(", ")[1]
# Get Python syntax error
#
synerror = traceback.format_exc().splitlines()[-1]
return line, filename, synerror

def main(): proxy_port = 80 proxy_url = 'msn-proxy.xxxxxx.com'

securityinfo = {}
securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI
securityinfo['username'] = "RandySincoular"#<UserName>
securityinfo['password'] = "xxxxxx"#<Password>
securityinfo['org_url'] = "http://www.arcgis.com"
securityinfo['proxy_url'] = proxy_url
securityinfo['proxy_port'] = proxy_port
securityinfo['referer_url'] = None
securityinfo['token_url'] = None
securityinfo['certificatefile'] = None
securityinfo['keyfile'] = None
securityinfo['client_id'] = None
securityinfo['secret_id'] = None

itemId = "9f59af52c6474b61bc561bd6096b8ef7"#<Item ID>

layerName = "http://services3.arcgis.com/sqVn1QnQEPnGQy9r/arcgis/rest/services/AEOutageData2/FeatureServer"

# Path to Local FGDB Featureclass on PC
pathToFeatureClass = r"C:\gis\AEOutageData2.gdb\OutageEvent"

try:

    fst = featureservicetools.featureservicetools(securityinfo)

    if fst.valid == False:
        print fst.message
    else:
        print "calling AddFeatures ..."

        results = fst.AddFeaturesToFeatureLayer(layerName,pathToFeatureClass,chunksize=2000)

        print "done adding feature"

except (common.ArcRestHelperError),e:
    print "error in function: %s" % e[0]['function']
    print "error on line: %s" % e[0]['line']
    print "error in file name: %s" % e[0]['filename']
    print "with error message: %s" % e[0]['synerror']
    if 'arcpyError' in e[0]:
        print "with arcpy message: %s" % e[0]['arcpyError']

except:
    line, filename, synerror = trace()
    print "error on line: %s" % line
    print "error in file name: %s" % filename
    print "with error message: %s" % synerror

if name == "main": main()

Output * Remote Interpreter Reinitialized *

calling AddFeatures ... 1 features in layer error in function: AddFeaturesToFeatureLayer error on line: line 510 error in file name: C:\Python27\ArcGIS10.2\lib\site-packages\arcresthelper\featureservicetools.py with error message: URLError: <urlopen error [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>

Randy

From: Michael Miller [mailto:notifications@github.com] Sent: Wednesday, April 20, 2016 8:01 AM To: Esri/ArcREST Cc: Sincoular, Randy; Author Subject: Re: [Esri/ArcREST] Need Assistance with "adds_rows_to_service.py" sample script (#222)

Randy, That is not the item id, that is the org id. The item id is the id in the url when you are looking at the item in the browser. Not the rest url of the service.

All you need to do it this:

fst = featureservicetools.featureservicetools(securityinfo) if fst.valid == False: print fst.message else: results = fst.AddFeaturesToFeatureLayer(url=your url to the feature layer, pathToFeatureClass=pathToFeatureClass, chunksize=2000)

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_Esri_ArcREST_issues_222-23issuecomment-2D212414156&d=CwMCaQ&c=GUDVeAVg1gjs_GJkmwL1m3gEzDND7NeJG5BIAX_2yRE&r=VPwuEa_rNmp_UVm0od-YvdtKnlNWqqwbpxa2Pz1fNVE&m=INKqa5BLMTEPUX9xxTKr8hnv0vBQRCMfsl4zu-N5zGg&s=gPB9h8bnkUCA2dWrQVJXDO2IWNCv2pEUiPg5f3h7qd4&e=

MikeMillerGIS commented 8 years ago

You need to use the url to the feature layer not the service in the code you provide.

RandySincoular commented 8 years ago

Hi Mike – well, it looks like I am getting a step closer. I added an additional feature to the FGDB, it now has 2 records. The script runs much quicker and no errors. The AGOL feature layer still has 19 records in it. I also tried an export to a CSV and that also has only 19 records. The 2 records from the FGDB are not getting added to the AGOL feature layer.

Output

calling AddFeatures ... 2 features in layer done adding feature

Script

""" This sample shows how to delete rows from a layer version 3.0.1 Python 2 """ import arcrest from arcresthelper import featureservicetools from arcresthelper import common

def trace(): """ trace finds the line, the filename and error message and returns it to the user """ import traceback, inspect,sys tb = sys.exc_info()[2] tbinfo = traceback.format_tb(tb)[0] filename = inspect.getfile(inspect.currentframe())

script name + line number

line = tbinfo.split(", ")[1]
# Get Python syntax error
#
synerror = traceback.format_exc().splitlines()[-1]
return line, filename, synerror

def main(): proxy_port = 80 proxy_url = 'msn-proxy.xxxxxx.com'

securityinfo = {}
securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI
securityinfo['username'] = "RandySincoular"#<UserName>
securityinfo['password'] = "xxxxxx"#<Password>
securityinfo['org_url'] = "http://www.arcgis.com"
securityinfo['proxy_url'] = proxy_url
securityinfo['proxy_port'] = proxy_port
securityinfo['referer_url'] = None
securityinfo['token_url'] = None
securityinfo['certificatefile'] = None
securityinfo['keyfile'] = None
securityinfo['client_id'] = None
securityinfo['secret_id'] = None

itemId = "9f59af52c6474b61bc561bd6096b8ef7"#<Item ID>

# Get error about timeout
# layerName = "http://services3.arcgis.com/sqVn1QnQEPnGQy9r/arcgis/rest/services/AEOutageData2/FeatureServer"

# This might work.  It's the URL to the actual feature layer, not the REST URL
layerName = "http://xxxxxx.maps.arcgis.com/home/item.html?id=9f59af52c6474b61bc561bd6096b8ef7"

# Path to Local FGDB Featureclass on PC
pathToFeatureClass = r"C:\gis\AEOutageData2.gdb\OutageEvent"

try:

    fst = featureservicetools.featureservicetools(securityinfo)

    if fst.valid == False:
        print fst.message
    else:
        print "calling AddFeatures ..."

        results = fst.AddFeaturesToFeatureLayer(layerName,pathToFeatureClass,chunksize=2000)

        print "done adding feature"

except (common.ArcRestHelperError),e:
    print "error in function: %s" % e[0]['function']
    print "error on line: %s" % e[0]['line']
    print "error in file name: %s" % e[0]['filename']
    print "with error message: %s" % e[0]['synerror']
    if 'arcpyError' in e[0]:
        print "with arcpy message: %s" % e[0]['arcpyError']

except:
    line, filename, synerror = trace()
    print "error on line: %s" % line
    print "error in file name: %s" % filename
    print "with error message: %s" % synerror

if name == "main": main()

Randy

From: Sincoular, Randy Sent: Wednesday, April 20, 2016 9:18 AM To: 'Esri/ArcREST' Subject: RE: [Esri/ArcREST] Need Assistance with "adds_rows_to_service.py" sample script (#222)

Hi Mike – I appreciate your help and patience troubleshooting this.

I modified the script using your sample. It looks like it gets to the point of reading records from my local FGDB – it only has 1 record. Then it sits for a little bit and comes back with the error message.

Are there any limitations to the FGDB? The FGDB has the following fields: OBJECTID, SHAPE, DMS_BEGIN_TIME, NUM_CUST_OUT The AGOL feature layer has the following fields: OBJECTID, DMS_BEGIN_TIME, NUM_CUST_OUT

Output * Remote Interpreter Reinitialized *

calling AddFeatures ... 1 features in layer error in function: AddFeaturesToFeatureLayer error on line: line 510 error in file name: C:\Python27\ArcGIS10.2\lib\site-packages\arcresthelper\featureservicetools.py with error message: URLError: <urlopen error [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>

Modified Script

import arcrest from arcresthelper import featureservicetools from arcresthelper import common

def trace(): """ trace finds the line, the filename and error message and returns it to the user """ import traceback, inspect,sys tb = sys.exc_info()[2] tbinfo = traceback.format_tb(tb)[0] filename = inspect.getfile(inspect.currentframe())

script name + line number

line = tbinfo.split(", ")[1]
# Get Python syntax error
#
synerror = traceback.format_exc().splitlines()[-1]
return line, filename, synerror

def main(): proxy_port = 80 proxy_url = 'msn-proxy.xxxxxxx.com'

securityinfo = {}
securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI
securityinfo['username'] = "RandySincoular"#<UserName>
securityinfo['password'] = "xxxxx"#<Password>
securityinfo['org_url'] = "http://www.arcgis.com"
securityinfo['proxy_url'] = proxy_url
securityinfo['proxy_port'] = proxy_port
securityinfo['referer_url'] = None
securityinfo['token_url'] = None
securityinfo['certificatefile'] = None
securityinfo['keyfile'] = None
securityinfo['client_id'] = None
securityinfo['secret_id'] = None

itemId = "9f59af52c6474b61bc561bd6096b8ef7"#<Item ID>

layerName = "http://services3.arcgis.com/sqVn1QnQEPnGQy9r/arcgis/rest/services/AEOutageData2/FeatureServer"

# Path to Local FGDB Featureclass on PC
pathToFeatureClass = r"C:\gis\AEOutageData2.gdb\OutageEvent"

try:

    fst = featureservicetools.featureservicetools(securityinfo)

    if fst.valid == False:
        print fst.message
    else:
        print "calling AddFeatures ..."

        results = fst.AddFeaturesToFeatureLayer(layerName,pathToFeatureClass,chunksize=2000)

        print "done adding feature"

except (common.ArcRestHelperError),e:
    print "error in function: %s" % e[0]['function']
    print "error on line: %s" % e[0]['line']
    print "error in file name: %s" % e[0]['filename']
    print "with error message: %s" % e[0]['synerror']
    if 'arcpyError' in e[0]:
        print "with arcpy message: %s" % e[0]['arcpyError']

except:
    line, filename, synerror = trace()
    print "error on line: %s" % line
    print "error in file name: %s" % filename
    print "with error message: %s" % synerror

if name == "main": main()

Output * Remote Interpreter Reinitialized *

calling AddFeatures ... 1 features in layer error in function: AddFeaturesToFeatureLayer error on line: line 510 error in file name: C:\Python27\ArcGIS10.2\lib\site-packages\arcresthelper\featureservicetools.py with error message: URLError: <urlopen error [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>

Randy

From: Michael Miller [mailto:notifications@github.com] Sent: Wednesday, April 20, 2016 8:01 AM To: Esri/ArcREST Cc: Sincoular, Randy; Author Subject: Re: [Esri/ArcREST] Need Assistance with "adds_rows_to_service.py" sample script (#222)

Randy, That is not the item id, that is the org id. The item id is the id in the url when you are looking at the item in the browser. Not the rest url of the service.

All you need to do it this:

fst = featureservicetools.featureservicetools(securityinfo) if fst.valid == False: print fst.message else: results = fst.AddFeaturesToFeatureLayer(url=your url to the feature layer, pathToFeatureClass=pathToFeatureClass, chunksize=2000)

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_Esri_ArcREST_issues_222-23issuecomment-2D212414156&d=CwMCaQ&c=GUDVeAVg1gjs_GJkmwL1m3gEzDND7NeJG5BIAX_2yRE&r=VPwuEa_rNmp_UVm0od-YvdtKnlNWqqwbpxa2Pz1fNVE&m=INKqa5BLMTEPUX9xxTKr8hnv0vBQRCMfsl4zu-N5zGg&s=gPB9h8bnkUCA2dWrQVJXDO2IWNCv2pEUiPg5f3h7qd4&e=

MikeMillerGIS commented 8 years ago

FeatureLayer is http://services3.arcgis.com/sqVn1QnQEPnGQy9r/arcgis/rest/services/AEOutageData2/FeatureServer/0 FeatureService is http://services3.arcgis.com/sqVn1QnQEPnGQy9r/arcgis/rest/services/AEOutageData2/FeatureServer Item ID is 9f59af52c6474b61bc561bd6096b8ef7

AddFeaturesToFeatureLayer expects the FeatureLayer

You are mixing the different ways here.

RandySincoular commented 8 years ago

Hi Mike – I have the two variables set but am getting the error below:

Output

calling AddFeatures ... 2 features in layer error in function: AddFeaturesToFeatureLayer error on line: line 510 error in file name: C:\Python27\ArcGIS10.2\lib\site-packages\arcresthelper\featureservicetools.py with error message: URLError: <urlopen error [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>

Script

""" This sample shows how to delete rows from a layer version 3.0.1 Python 2 """ import arcrest from arcresthelper import featureservicetools from arcresthelper import common

def trace(): """ trace finds the line, the filename and error message and returns it to the user """ import traceback, inspect,sys tb = sys.exc_info()[2] tbinfo = traceback.format_tb(tb)[0] filename = inspect.getfile(inspect.currentframe())

script name + line number

line = tbinfo.split(", ")[1]
# Get Python syntax error
#
synerror = traceback.format_exc().splitlines()[-1]
return line, filename, synerror

def main(): proxy_port = 80 proxy_url = 'msn-proxy.xxxxxxxxx.com'

securityinfo = {}
securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI
securityinfo['username'] = "RandySincoular"#<UserName>
securityinfo['password'] = "xxxxxx"#<Password>
securityinfo['org_url'] = "http://www.arcgis.com"
securityinfo['proxy_url'] = proxy_url
securityinfo['proxy_port'] = proxy_port
securityinfo['referer_url'] = None
securityinfo['token_url'] = None
securityinfo['certificatefile'] = None
securityinfo['keyfile'] = None
securityinfo['client_id'] = None
securityinfo['secret_id'] = None

itemId = "9f59af52c6474b61bc561bd6096b8ef7"#<Item ID>

# Get error: URLError: <urlopen error [Errno 10060]
layerName = "http://services3.arcgis.com/sqVn1QnQEPnGQy9r/arcgis/rest/services/AEOutageData2/FeatureServer/0"

# Path to Local FGDB Featureclass on PC
pathToFeatureClass = r"C:\gis\AEOutageData2.gdb\OutageEvent"

try:

    fst = featureservicetools.featureservicetools(securityinfo)

    if fst.valid == False:
        print fst.message
    else:
        print "calling AddFeatures ..."

        results = fst.AddFeaturesToFeatureLayer(layerName,pathToFeatureClass,chunksize=2000)

        print "done adding feature"

except (common.ArcRestHelperError),e:
    print "error in function: %s" % e[0]['function']
    print "error on line: %s" % e[0]['line']
    print "error in file name: %s" % e[0]['filename']
    print "with error message: %s" % e[0]['synerror']
    if 'arcpyError' in e[0]:
        print "with arcpy message: %s" % e[0]['arcpyError']

except:
    line, filename, synerror = trace()
    print "error on line: %s" % line
    print "error in file name: %s" % filename
    print "with error message: %s" % synerror

if name == "main": main()

From: Michael Miller [mailto:notifications@github.com] Sent: Wednesday, April 20, 2016 9:54 AM To: Esri/ArcREST Cc: Sincoular, Randy; Author Subject: [Marketing Mail] Re: [Esri/ArcREST] Need Assistance with "adds_rows_to_service.py" sample script (#222)

FeatureLayer is http://services3.arcgis.com/sqVn1QnQEPnGQy9r/arcgis/rest/services/AEOutageData2/FeatureServer/0 FeatureService is http://services3.arcgis.com/sqVn1QnQEPnGQy9r/arcgis/rest/services/AEOutageData2/FeatureServer Item ID is 9f59af52c6474b61bc561bd6096b8ef7

AddFeaturesToFeatureLayer expects the FeatureLayer

You are mixing the different ways here.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_Esri_ArcREST_issues_222-23issuecomment-2D212459873&d=CwMCaQ&c=GUDVeAVg1gjs_GJkmwL1m3gEzDND7NeJG5BIAX_2yRE&r=VPwuEa_rNmp_UVm0od-YvdtKnlNWqqwbpxa2Pz1fNVE&m=r9dlakD6SoswFdAWHprfJDsum7mXXgbAwM1KQCQej-Q&s=P5dAyMbptdjdjy-Cb_Ld-8Hc9WJs9K2lKpugl_CZ6tM&e=

MikeMillerGIS commented 8 years ago

?That appears to be a proxy error, could you try this process outside your network? The script looks correct.

RandySincoular commented 8 years ago

Hi Mike – that did it! Once I connected outside of our firewall, I was able to append features from a FGDB to an AGOL service layer. Thanks a bunch for helping to troubleshoot this. You saved me a ton of time. I need to talk to our security group next to find out what is blocking the connection.

Thanks again,

Randy

From: Michael Miller [mailto:notifications@github.com] Sent: Wednesday, April 20, 2016 10:13 AM To: Esri/ArcREST Cc: Sincoular, Randy; Author Subject: Re: [Esri/ArcREST] Need Assistance with "adds_rows_to_service.py" sample script (#222)

?That appears to be a proxy error, could you try this process outside your network? The script looks correct.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_Esri_ArcREST_issues_222-23issuecomment-2D212470646&d=CwMCaQ&c=GUDVeAVg1gjs_GJkmwL1m3gEzDND7NeJG5BIAX_2yRE&r=VPwuEa_rNmp_UVm0od-YvdtKnlNWqqwbpxa2Pz1fNVE&m=k8dE7JKDm6NmSsnSs3lPjhUj0x2CIMIrOXz8xR2LusQ&s=AWmMM3LFgsGNfJB2I-ragpfC_ExUoF6LBk26EozdwpE&e=