Esri / ArcREST

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

securityhandlerhelper does not default to portal #316

Closed thomas-maschler closed 7 years ago

thomas-maschler commented 7 years ago

ArcRest or ArcRestHelper

ArcRestHelper

Version or date of download

01/05/2017

Bug or Enhancement

When trying to retrieve a token I get the following error message

>>>import arcrest
>>>from arcresthelper import securityhandlerhelper
>>>config = {'username': 'user', 'password': 'secret'}
>>>token = securityhandlerhelper.securityhandlerhelper(config)

currentVersion  - attribute not implemented in Portal class.
hasCategorySchema  - attribute not implemented in Portal class.
currentVersion  - attribute not implemented in Portal class.
hasCategorySchema  - attribute not implemented in Portal class.

Traceback (most recent call last):
  File "<pyshell#15>", line 1, in <module>
    token = securityhandlerhelper.securityhandlerhelper(config)
  File "C:\Python27\ArcGIS10.3\lib\site-packages\arcresthelper\securityhandlerhelper.py", line 359, in __init__
    "synerror": synerror,
ArcRestHelperError: {'function': 'securityhandlerhelper_init', 'line': 'line 292', 'synerror': "KeyError: 'security_type'", 'filename': 'C:\\Python27\\ArcGIS10.3\\lib\\site-packages\\arcresthelper\\securityhandlerhelper.py'}

This error doesn't occur when I specify the Portal as security_type (although there is still some weird response)

>>>import arcrest
>>>from arcresthelper import securityhandlerhelper
>>>config = {'username': 'user', 'password': 'secret', 'security_type': 'Portal'}
>>>token = securityhandlerhelper.securityhandlerhelper(config)

currentVersion  - attribute not implemented in Portal class.
hasCategorySchema  - attribute not implemented in Portal class.
currentVersion  - attribute not implemented in Portal class.
hasCategorySchema  - attribute not implemented in Portal class.
'http'

Repo Steps or Enhancement details

Make Portal default security type again.

MikeMillerGIS commented 7 years ago

Using the version in Master, it does default to portal, https://github.com/Esri/ArcREST/blob/master/src/arcresthelper/securityhandlerhelper.py#L147

I tested your script it it runs.

BTW, token = securityhandlerhelper.securityhandlerhelper(config) does not return the token, it returns the securityhandlerhelper object. You will need to use token.securityhandler.token to get the token.