The Python Library Module

The Accelerator software package provides a Python library module called to make REST API usage from Python more convenient. The module implements a VOVRestV3 Python class with member functions described in the following text box. These functions hide the details associated with authenticating, session handling, and error handling. More example programs follow that utilize this convenient Python library layer.

VOVRestV3 Python Class Description

The VOVRestV3 Python class provides an interface to the Accelerator v3 REST API.

import vov_rest_v3
Member Functions
authorize (url, username=’’, password=’’)
The vovserver scheduling server authenticates a user for a VOVRestV3 and obtains a validating access token behind the scenes, storing it in the VOVRestV3 object.
Positional Arguments
url – (string) the URL as returned by nc cmd vovbrowser
password -- (string) the current user password
Keyword Arguments
username – (string) user name, usually the same as the Linux user name known to vovserver. If this argument is not provided it defaults to the current user identified by $USER
Return Value
None. Raises exceptions upon failure.
submitRequest (method, url, queryParams={}, jsonData={})
Submits a REST/ HTTP request to the server.
Positional Arguments
method – (string) one of: “GET”, “POST”, “PUT”, “DELETE”, “PATCH”.
url – (string) the URL as returned by nc cmd vovbrowser -url RESTPATH.
Examples of RESTPATH are: /api/v3/jobs or /api/v3/projects/1.
Keyword Arguments
queryParams – (dictionary) keywords and values in string fromat for GET requests
jsonData – (dictionary) keywords and values in string fromat for POST requests
Return Value
(string) The HTTP request response text.
Retrieve the JSON Web Token (JWT) for the object.
Return Value: (string) the JWT string
Replace the JSON Web Token (JWT) for the object.
Positional Arguments
token – (string) the replacement JWT to be remembered in the object and used for subsequent REST requests
Return Value