Esri / ArcREST

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

Does this work with Arcgis Online Enterprise accounts? #339

Open ghost opened 7 years ago

ghost commented 7 years ago

Does this work with ArcGIS Online Enterprise accounts? If so, could you provide a snippet of code to get us headed in the right direction? Thank you for your time.

MikeMillerGIS commented 7 years ago

You can use run the script inside ArcMap so it can use the login token from that. It cannot be used as a stand alone script

ghost commented 7 years ago

So using the "getting started" example below, would we simply not need the configuration line or would we still need to provide a username and password?

`import arcrest from arcresthelper import securityhandlerhelper

config = {'username': 'myusername', 'password': 'myp4ssword'} token = securityhandlerhelper.securityhandlerhelper(config) admin = arcrest.manageorg.Administration(securityHandler=token.securityhandler) content = admin.content userInfo = content.users.user() userInfo.folders`

Thanks!

MikeMillerGIS commented 7 years ago

You can see in this example where the script is digesting ArcMaps token.
https://github.com/Esri/ArcREST/blob/master/tools/src/append_fc_to_fs.py#L108

ghost commented 7 years ago

Are you referring to this line ? securityinfo['security_type'] = 'ArcGIS'#LDAP, NTLM, OAuth, Portal, PKI

We're trying to filter out what we need and what we don't need from that example. Basically what we want to do is download a feature class from AGOL, using an enterprise account.

MikeMillerGIS commented 7 years ago

Yes, just you need to run it in ArcMap. That line gets the token from ArcMap.