Bases: object
The EsriSession class is designed to simplify access to the Esri WebGIS environments without the additional components of the arcgis or arcpy modules. It is designed to allow users to connect and manage all HTTP calls themselves with no hand holding.
Security is handled through the requests authentication model. Leveraging authentication handlers and primarily connecting to 10.8.1+ enterprise components.
The supported Authentication Schemes are:
Username/Password
Oauth 2
IWA/NTLM
Basic
Digest
PKI
API Keys
User Provided Tokens
Kerberos
Anyone can extend the authentication handlers by creating a class and inheriting from requests.auth.AuthBase.
The EsriSession authentication supports authentication chaining. Meaning users can stack authentication methods.
auth1 + auth2 + auth3
It is recommended that you do not stack unneeded authenticators because they can caused unintended failures.
Parameter
Description
auth
Optional AuthBase. This is a security handler that performs some sort of security check.
cert
Optional Tuple. The client side certificate as a tuple or string. It should be noted that EsriSession does not support encrypted private keys.
verify_cert
Optional Bool. When False all SSL certificate errors are ignored. The default is True.
allow_redirects
Optional Bool. When False if the URL redirects a user, an error will be raised. The default is True
headers
Optional Dict. An additional set of key/value(s) to append to any requestâs header.
referer
Optional Str. The referer header value. The default is http. This is mainly used with token security.
Optional Arguments
Parameter
Description
trust_env
Optional Bool. The default is True. If False proxies will cause an error to be raised if set by .netrc files.
stream
Optional Bool. To enable handling streaming responses, set stream to True and iterate over the response with iter_lines. The default is False.
check_hostname
Optional Bool. When connecting to a side via IP Address with an SSL certificate, the hostname will not match. This allows a user to specify the hostname in the headers parameters and ignore hostname errors.
retries
Optional Int. The max number of tries to retry a service for 50x errors.
backoff_factor
Optional float. The amount of time in seconds to wait between retries.
status_to_retry
Optional Tuple. The status codes to run retries on. The default is (413, 429, 503, 500, 502, 504).
method_whitelist
Optional List. When retries is specified, the user can specify what methods are retried. The default is âPOSTâ, âDELETEâ, âGETâ, âHEADâ, âOPTIONSâ, âPUTâ, âTRACEâ
proxies
Optional Dict. A key/value mapping where the keys are the transfer protocol and the value is the <url>:<port>.
example
`python proxies = {"http" : 127.0.0.1:8080, "https" : 127.0.0.1:8081} session = EsriSession(proxies=proxies) `
Returns an dictionary of mounted adapters.
dict
Get/Set the Authentication Handler for the Session
returns the path to the extra CA bundles
Get/Set the users certificate as a (private, public) keys.
Tuple[str]
Closes all adapters and as such the session
Sends a DELETE request. Returns Response
object.
url â URL for the new Request
object.
**kwargs â Optional arguments that request
takes.
requests.Response
Sends a GET request. Returns Response
object.
url â URL for the new Request
object.
**kwargs â Optional arguments that request
takes.
requests.Response
Sends a HEAD request. Returns Response
object.
url â URL for the new Request
object.
**kwargs â Optional arguments that request
takes.
requests.Response
Gets/Sets the headers from the current session object
Registers a connection adapter to a prefix.
Adapters are sorted in descending order by prefix length.
Sends a OPTIONS request. Returns Response
object.
url â URL for the new Request
object.
**kwargs â Optional arguments that request
takes.
requests.Response
Sends a PATCH request. Returns Response
object.
url â URL for the new Request
object.
data â (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the Request
.
**kwargs â Optional arguments that request
takes.
requests.Response
Sends a POST request. Returns Response
object.
url â URL for the new Request
object.
data â (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the Request
.
json â (optional) json to send in the body of the Request
.
**kwargs â Optional arguments that request
takes.
requests.Response
Dictionary mapping protocol or protocol and host to the URL of the proxy. (e.g. {âhttpâ: âfoo.bar:3128â, âhttp://host.nameâ: âfoo.bar:4012â}) to be used on each Request
.
dict
Sends a PUT request. Returns Response
object.
url â URL for the new Request
object.
data â (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the Request
.
**kwargs â Optional arguments that request
takes.
requests.Response
Gets/Sets the referer
Gets/Sets the stream property for the current session object
Trust environment settings for proxy configuration, default authentication and similar.
Performs an update call on the headers
Get/Set property that allows for the verification of SSL certificates
bool
Bases: AuthBase
, SupportMultiAuth
Performs the ArcGIS Pro Authentication for a given request.
Handles Case where token is invalid
obtains the login token
Bases: AuthBase
A base class that developers can inherit from to create custom authentication handlers.
For more information, please see: https://docs.python-requests.org/en/master/user/authentication/#new-forms-of-authentication
response hook logic
Response
returns a ArcGIS Token as a string
string
Bases: AuthBase
, SupportMultiAuth
authentication for API Keys
generates a server token using Portal token
Gets/Sets the API token
String
Bases: HTTPBasicAuth
, SupportMultiAuth
Describes a basic requests authentication.
generates a server token using Portal token
Gets the token. This is always None for EsriBasicAuth
String
Bases: AuthBase
, SupportMultiAuth
Performs the BUILT-IN Login Authorization for ArcGIS Online and Enterprise
creates the authorization URL
handles the issues in the response where token might be rejected
Invalidates the login and checks any licenses back in
Bool. If True, the licenses is checked back in successfully, False, the process failed.
obtains the login token
Bases: AuthBase
, SupportMultiAuth
This form of Authentication leverages the generateToken endpoint from the ArcGIS Product. This is supported for ArcGIS Online, ArcGIS Enterprise and ArcGIS Server.
This form of authentication is considered legacy and should only be used with unfederated server products.
Gets the time the token will expire on
returns the time out time in minutes
Bases: AuthBase
HTTP NTLM Authentication Handler for Requests.
Supports pass-the-hash.
This is derived from work of Jordan Borean and requests-ntlm/requests-ntlm2
generates the server token
The actual hook handler.
Performs the NTLM handshake
Bases: Exception
Exception raised for http errors.
message â explanation of the error
Bases: AuthBase
, SupportMultiAuth
generates a server token using Portal token
Gets the token. This is always None for KerberosAuth
String
Bases: AuthBase
, SupportMultiAuth
authentication for notebook servers Keys
generates a server token using Portal token
Gets/Sets the API token
String
Bases: AuthBase
, SupportMultiAuth
Performs the OAuth Workflow for logging in to Enterprise
Handles Case where token is invalid
Gets the Oauth token
String
Bases: BaseEsriAuth
Implements OAuth 2.0 PKCE Workflow
response hook logic
Response
returns a ArcGIS Token as a string
string
Bases: AuthBase
, SupportMultiAuth
Handles PKI authentication when tokens are needed
generates a server token using Portal token
returns the authentication token
Bases: object
The EsriSession class is designed to simplify access to the Esri WebGIS environments without the additional components of the arcgis or arcpy modules. It is designed to allow users to connect and manage all HTTP calls themselves with no hand holding.
Security is handled through the requests authentication model. Leveraging authentication handlers and primarily connecting to 10.8.1+ enterprise components.
The supported Authentication Schemes are:
Username/Password
Oauth 2
IWA/NTLM
Basic
Digest
PKI
API Keys
User Provided Tokens
Kerberos
Anyone can extend the authentication handlers by creating a class and inheriting from requests.auth.AuthBase.
The EsriSession authentication supports authentication chaining. Meaning users can stack authentication methods.
auth1 + auth2 + auth3
It is recommended that you do not stack unneeded authenticators because they can caused unintended failures.
Parameter
Description
auth
Optional AuthBase. This is a security handler that performs some sort of security check.
cert
Optional Tuple. The client side certificate as a tuple or string. It should be noted that EsriSession does not support encrypted private keys.
verify_cert
Optional Bool. When False all SSL certificate errors are ignored. The default is True.
allow_redirects
Optional Bool. When False if the URL redirects a user, an error will be raised. The default is True
headers
Optional Dict. An additional set of key/value(s) to append to any requestâs header.
referer
Optional Str. The referer header value. The default is http. This is mainly used with token security.
Optional Arguments
Parameter
Description
trust_env
Optional Bool. The default is True. If False proxies will cause an error to be raised if set by .netrc files.
stream
Optional Bool. To enable handling streaming responses, set stream to True and iterate over the response with iter_lines. The default is False.
check_hostname
Optional Bool. When connecting to a side via IP Address with an SSL certificate, the hostname will not match. This allows a user to specify the hostname in the headers parameters and ignore hostname errors.
retries
Optional Int. The max number of tries to retry a service for 50x errors.
backoff_factor
Optional float. The amount of time in seconds to wait between retries.
status_to_retry
Optional Tuple. The status codes to run retries on. The default is (413, 429, 503, 500, 502, 504).
method_whitelist
Optional List. When retries is specified, the user can specify what methods are retried. The default is âPOSTâ, âDELETEâ, âGETâ, âHEADâ, âOPTIONSâ, âPUTâ, âTRACEâ
proxies
Optional Dict. A key/value mapping where the keys are the transfer protocol and the value is the <url>:<port>.
example
`python proxies = {"http" : 127.0.0.1:8080, "https" : 127.0.0.1:8081} session = EsriSession(proxies=proxies) `
Returns an dictionary of mounted adapters.
dict
Get/Set the Authentication Handler for the Session
returns the path to the extra CA bundles
Get/Set the users certificate as a (private, public) keys.
Tuple[str]
Closes all adapters and as such the session
Sends a DELETE request. Returns Response
object.
url â URL for the new Request
object.
**kwargs â Optional arguments that request
takes.
requests.Response
Sends a GET request. Returns Response
object.
url â URL for the new Request
object.
**kwargs â Optional arguments that request
takes.
requests.Response
Sends a HEAD request. Returns Response
object.
url â URL for the new Request
object.
**kwargs â Optional arguments that request
takes.
requests.Response
Gets/Sets the headers from the current session object
Registers a connection adapter to a prefix.
Adapters are sorted in descending order by prefix length.
Sends a OPTIONS request. Returns Response
object.
url â URL for the new Request
object.
**kwargs â Optional arguments that request
takes.
requests.Response
Sends a PATCH request. Returns Response
object.
url â URL for the new Request
object.
data â (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the Request
.
**kwargs â Optional arguments that request
takes.
requests.Response
Sends a POST request. Returns Response
object.
url â URL for the new Request
object.
data â (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the Request
.
json â (optional) json to send in the body of the Request
.
**kwargs â Optional arguments that request
takes.
requests.Response
Dictionary mapping protocol or protocol and host to the URL of the proxy. (e.g. {âhttpâ: âfoo.bar:3128â, âhttp://host.nameâ: âfoo.bar:4012â}) to be used on each Request
.
dict
Sends a PUT request. Returns Response
object.
url â URL for the new Request
object.
data â (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the Request
.
**kwargs â Optional arguments that request
takes.
requests.Response
Gets/Sets the referer
Gets/Sets the stream property for the current session object
Trust environment settings for proxy configuration, default authentication and similar.
Performs an update call on the headers
Get/Set property that allows for the verification of SSL certificates
bool
Bases: AuthBase
, SupportMultiAuth
Authentication Using User Created Tokens
Handles Case where token is invalid
Bases: AuthBase
, SupportMultiAuth
generates a server token using Portal token
Gets the token. This is always None for EsriWindowsAuth
String
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4