Closed pfoppe closed 6 years ago
sample code snippet:
s = requests.session()
s.auth = ArcGISPortalAuth(uname,pwd)
response = s.get(r'https://org.maps.arcgis.com/sharing/rest/portals/self?f=json')
>>> s.auth._last_request
<Response [405]>
>>> s.auth._last_request.request.url
'https://org.maps.arcgis.com//sharing/rest/generateToken'
>>> s.auth._last_request.request.method
'HEAD'
>>> s.auth._last_request.reason
'Method Not Allowed'
The ArcGISPortalAuth handler will first attempt token authentication. the first request uses the HEAD method in an attempt to see if an anonymous request can succeed, and if so it will not attempt Kerberos/NTLM (since it does not receive the HTTP status code 401 challenge).
Ran into an issue where the HEAD method was not supported, Updated code to execute a POST if an HTTP 405 is received on the HEAD request.
Possibly also an issue with ArcGISServerAuth, however have not experienced that yet.