Select to view content in your preferred language

I am using ArcREST-3 to update feature but I get 'ImportError: cannot import name securityhandlerhelper'

4288
4
10-06-2015 07:11 AM
JulieK
by
Regular Contributor

Hello,

I installed the latest version but I keep getting the error " ImportError: cannot import name securityhandlerhelper"

I am trying the update feature sample as below:

from arcresthelper import securityhandlerhelper
from arcrest.agol import FeatureLayer
from arcrest.common.filters import LayerDefinitionFilter
import datetime
from datetime import timedelta
from arcrest.common.general import local_time_to_online,online_time_to_string
if __name__ == "__main__":
  url = 'URL to Service'
  sql = 'where clause'
  
  dt = local_time_to_online(datetime.datetime.now())
  
  fieldInfo =[
  
  {
   'FieldName':'dischrgtyp',
   'ValueToSet':'Alert'
  }
  ]
  
  proxy_port = None
  proxy_url = None  
  securityinfo = {}
  securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI, ArcGIS
  securityinfo['username'] = "<User Name>"
  securityinfo['password'] = "<Password>"
  securityinfo['org_url'] = "<Org or portal url>"
  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  
  
  shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo)
   if shh.valid == False:
   print shh.message
   else:
  fl= FeatureLayer(
   url=url,
   securityHandler=shh.securityhandler,
   proxy_port=proxy_port,
   proxy_url=proxy_url,
   initialize=True)
  
  out_fields = ['objectid']
   for fld in fieldInfo:
  out_fields.append(fld['FieldName'])
  
  resFeats = fl.query(where=sql,
   out_fields=",".join(out_fields))
   for feat in resFeats:
  
   for fld in fieldInfo:
  feat.set_value(fld["FieldName"],fld['ValueToSet'])
  
   print fl.updateFeature(features=resFeats)

thanks,

Julie

Tags (2)
0 Kudos
4 Replies
MikeMillerGIS
Esri Frequent Contributor

The securityhandlerhelper is part of the ArcRestHelper.  Can you verify this is installed?  Also, what sample are you following, we have not upgraded all samples and if you add an issue on the ArcRest github repo we will get it upgraded for you.

0 Kudos
AllenScully
Frequent Contributor

I'm also having this issue, but it seems to be simply a matter of where to put the ArcRest files.   I have an ArcREST folder within the Python27\ArcGIS10.3  directory, and clearly some of the ArcRest python files and modules are not where they need to be.

Any thoughts on where to put the ArcREST files once they are downloaded?  I have run an install using pip for ArcRest, and it ran successfully but again, not everything is apparently stored where it needs to be.

Thanks -

Allen

0 Kudos
MikeMillerGIS
Esri Frequent Contributor

This screen shot should help

AllenScully
Frequent Contributor

Indeed, quite helpful.  Just what I needed to see.  Thanks Michael.

0 Kudos