Link Search Menu Expand Document

arena-py API v1.0.1

arena.auth

auth.py - Authentication methods for accessing the ARENA.

class ArenaAuth:
def authenticate_user(self, web_host, headless):

Begins authentication flow, getting Google auth, opening web browser if needed, getting username and state from ARENA server.

Parameters
  • str web_host: The hostname of the ARENA webserver.
Returns

Username from arena-account, or None.

def authenticate_scene(self, web_host, realm, scene, username, video=False):

End authentication flow, requesting permissions may change by owner or admin, for now, get a fresh mqtt_token each time.

Parameters
  • str web_host: The hostname of the ARENA webserver.
  • str realm: The topic realm name.
  • str scene: The namespace/scene name combination.
  • str username: The ARENA username for the user.
  • bool video: If Jitsi video conference is requested.
Returns

username and mqtt_token from arena-account.

def authenticate_device(self, web_host):

Check for device mqtt_token, ask for a missing one, and save to local memory.

def has_publish_rights(self, token, topic):

Check the MQTT token for permission to publish to topic.

def get_writable_scenes(self, web_host):

Request list of scene names for logged in user that user has publish permission for.

Parameters
  • str web_host: The hostname of the ARENA webserver.
Returns

list of scenes.

def store_environment_auth(self, username, token):

Keep a copy of the token in local memory for urlopen and other tasks.

def check_local_auth(self):

Check for local mqtt_token and save to local memory.

def verify(self, web_host):
def urlopen_def(self, url, data=None):

urlopen default is for non-ARENA URL connections.

Parameters
  • str url: the url to POST/GET.
  • str data: None for GET, add params for POST.
def urlopen(self, url, data=None, creds=False, csrf=None):

urlopen is for ARENA URL connections.

Parameters
  • str url: the url to POST/GET.
  • str data: None for GET, add params for POST.
  • bool creds: True to pass the MQTT token as a cookie.
  • str csrf: The csrftoken.
def signout():
def permissions():

Table of contents