项目作者: DOI-BLM

项目描述 :
Authentication handler for using Esri ArcGIS for Server and Portal (ArcGIS Online) Token Authentication with Python Requests
高级语言: Python
项目地址: git://github.com/DOI-BLM/requests-arcgis-auth.git
创建时间: 2017-05-20T04:05:26Z
项目社区:https://github.com/DOI-BLM/requests-arcgis-auth

开源协议:

下载


Esri ArcGIS Authentication Handlers for Python Requests API

Authenticate to Esri ArcGIS for Server, Portal and ArcGIS Online (AGOL) using Python Requests


This module provides python requests authentication handlers for the Esri ArcGIS Server and Portal products. The purpose is to authenticate a user to obtain authorized access to protected data and functions in the Esri REST API. There are endless use cases to automate business or IT administrative workflows… here are a few examples:
1) Automate user management (creating/removing users or modifying users roles/permissions)
2) Automate service publishing
3) Completing geospatial data analysis (for protected services)

The authentication handlers support the following deployment models:

  • Propritery ‘Token-Based’ Authentication
  • Web-Tier security using NTLM or Kerberos (Microsoft Integrated Windows Authentication)
  • SAML based ‘enterprise logins’ (OAuth2)*

*Only supports SAML services with Kerberos authentication (no forms based login)

More information and examples can be found at - https://doi-blm.github.io/requests-arcgis-auth/

Basic Usage Examples:

ArcGIS for Server “Token Authentication” Usage (Non-Session Based):

  1. import requests
  2. from requests_arcgis_auth import ArcGISServerTokenAuth
  3. r = requests.get(r'https://host/arcgis/rest/services?f=json', auth=ArcGISServerTokenAuth(username,password))

ArcGIS Online and Portal for ArcGIS “Token” Authentication Usage:

  1. import requests
  2. from requests_arcgis_auth import ArcGISPortalTokenAuth
  3. s=requests.Session()
  4. s.auth = ArcGISPortalTokenAuth(username,password)
  5. r = s.get(r'https://host/sharing/rest?f=json')

ArcGIS Online and Portal for ArcGIS “Enterprise Logins via SAML” Authentication Usage:

  1. import requests
  2. from requests_arcgis_auth import ArcGISPortalSAMLAuth
  3. client_id = "123456789" # This client_id is that of a registered 'application' in the portal.
  4. auth = ArcGISPortalSAMLAuth(client_id)
  5. s = requests.session()
  6. s.auth = auth
  7. s.get("https://org.maps.arcgis.com/sharing/rest/portals/self?f=json")