/
How to generate VSS API access token using Python
How to generate VSS API access token using Python
This quick how-to was written with python 3.10.8 and requests 2.28.0
PyVSS is now the supported and recommended method to interact with the VSS API.
Step-by-step guide
The following steps demonstrate how to get an access token:
Import requests, sys, getpass and requests.auth.HTTPBasicAuth to handle endpoint authentication.
import getpass import sys import requests from requests.auth import HTTPBasicAuth
Get user from input and password via getpass.getpass() so it's not prompted.
# input argument usr = sys.argv[1] # Prompt the user for a password without echoing. pwd = getpass.getpass()
Set the authentication endpoint
token_endpoint = 'https://vss-api.eis.utoronto.ca/auth/request-token'
Make a POST request to token_request and create a new HTTPBasicAuth object initializing it with usr and pwd
Get JSON response body
Print Error if any or the token if succeeded:
Script
Full python script is showing below:
Related articles
, multiple selections available,
Related content
VSS: using TOTP in vss cli scripting
VSS: using TOTP in vss cli scripting
Read with this
Authentication
Authentication
More like this
Python client for the EIS Virtual Cloud RESTful API (py-vss) v0.8.8
Python client for the EIS Virtual Cloud RESTful API (py-vss) v0.8.8
More like this
Python client for the EIS Virtual Cloud RESTful API (py-vss) v0.9.8
Python client for the EIS Virtual Cloud RESTful API (py-vss) v0.9.8
More like this
pyvss
More like this
Python client for the EIS Virtual Cloud RESTful API (py-vss) v0.7.1
Python client for the EIS Virtual Cloud RESTful API (py-vss) v0.7.1
More like this