Extreme API with Python
Table Of Contents
- 1 Preface
- 2 Introduction
- 3 EXOS APIs
- 4 VOSS API
- 5 XMC API
- 6 ExtremeCloud IQ API
- 7 Extreme Campus Controller API
Extreme API with Python
Page | 14
Part no.9036931-00 Rev AA February 2021
password = getpass.getpass()
print("\nYou entered:\nUsername: {} Password: {}".format(username, password))
The result is shown below:
C:\Extreme API with Python> auth-examples.py
Username: Stef
Password:
You entered:
Username: Stef Password: extreme
If the application is running on a secure environment, another way to is to store passwords, keys, and
tokens as environment variables that the application can access. How you create environment variables
will depend on your operating system:
- In Windows, create environment variables from Control Panel > System > Advanced System
Settings > Environment Variables.
- With MacOS and Linux, add variables in the .batch_profile file, located in your home directory.
The syntax is export <Var Name>=”<Value>”. There are no spaces between the variable name, the
= sign and the value.
You can then access these environment variables with the OS module.
In this example, you have created (on Windows 10) 2 environment variables:
- MY_USER
- MY_PASSWORD
You can retrieve them from Python, without exposing them in the code:
import os
username = os.environ.get('MY_USER')
password = os.environ.get('MY_PASSWORD')
print("Username is: {}\nPassword is: {}".format(username, password))
The result:
C:\Extreme API with Python> auth-examples.py
Username is: Stef
Password is: extreme










