You can use the Admin API through standard username/password session setup (Example 1), or through the Arcadia APIKey system (Example 2). In the second approach, the client code must obtain the ArcViz access key through a client-controlled mechanism.
Subsequently, request headers include this key as the access credential, avoiding the login process (Example 3).
username = (user name as obtained from external source)
password = (password as obtained from external source)
session = requests.session()
response = session.get(login_url)
session.headers['referer'] = response.url
payload = {'username':username,
'password':password,
'csrfmiddlewaretoken':session.cookies['arccsrftoken']}
session.post(login_url, data=payload)
apikey = (apikey string as obtained from external source)
session = requests.session()
session.headers['AUTHORIZATION'] = 'apikey %s' % apikey
response = session.get(api_url + 'datasets?detail=1')
datasets = response.json()