Skip to content

Consider adding a helper function to determine the site security posture (derive user name, prompt for pwd) #35

Description

@pfoppe

The ArcGISServerAuth object supports a username/password as optional parameters... Only need to be supplied if the site is token authentication.

Could query the site "/arcgis/rest/info" to determine if its is Token Authentication. And if so,

Then derive the logged in user (down-level logon name format) and prompt for a password.

EX:

import requests
import os
import getpass

s = requests.session()
if <IS TOKEN AUTHENTICATION>:
    down_level_logon_name = r"{}\{}".format(os.getenv("userdomain"), getpass.getuser())
    pwd = getpass.getpass("Enter password for {}: ".format(down_level_logon_name))
    s.auth = ArcGISServerAuth(down_level_logon_name, pwd)
else:
    s.auth = ArcGISServerAuth()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions