Closed simoxu001 closed 8 years ago
Thanks @MikeMillerGIS , Could you give a little bit more details? or even better, a snippet of code if possible?
Does that mean I can use ArcGISTokenSecurityHandler for the securityHandler in the following code?
fs = FeatureService(
url=url,
securityHandler=agsSH,
proxy_port=proxy_port,
proxy_url=proxy_url,
initialize=True)
Yes, but the script must be run from within ArcMap or ArcCatalog. There are examples in the tools folder.
Hello, I've just used it.
I created a method to return a securityHandler using ArcMap connection. I hope it helps.
from arcresthelper import featureservicetools
def get_security_handler_using_arcmap_connection():
"""
Returns a valid securityhandler object using the current ArcGIS Online connection
** Only works inside ArcMAP / ArcCatalog - Versions > 10.2 **
Returns: securityhandler or a Exception if connection is not valid
"""
security_info = {'security_type': 'ArcGIS',
'proxy_url': None,
'proxy_port': None}
fs_tools = featureservicetools.featureservicetools(security_info)
if not fs_tools.valid:
raise Exception(fs_tools.message)
return fs_tools.securityhandler
Thanks @MikeMillerGIS @BrunoCaimar ArcGISTokenSecurityHandler works
I don't know if it's possible to access the credentials obtained by logging in AGOL in ArcCatalog/ArcMap in my own tool built upon ArcREST.
by doing this, I only need to login from ArcGIS Desktop once and then I will be able to run multiple tools without the need to create new AGOLTokenSecurityHandlers every time for each of them.
thanks