Python
The following code example is written in the Python language:
- # import "requests" library, for http requests
- import requests
- # define parts of the SecureKey request URL
- class classLogiSecureKeyURL:
- def __init__(object, url, user, roles, rights, ipaddress):
- object.cLogiAppUrl = url
- object.cUser = "?Username=" + user
- object.cRoles = "&Roles=" + roles
- object.cRights = "&Rights=" + rights
- object.cIPAddress = "&ClientBrowserAddress=" + ipaddress
- object.cSecureKeyUrl = url + "/rdTemplate/rdGetSecureKey.aspx" + "?Username=" + user + "&Roles=" + roles + "&Rights=" + rights + "&ClientBrowserAddress=" + ipaddress
- # make the SecureKey call and get the response
- def getSecureKey(classLogiSecureKeyURL):
- try:
- r = requests.get(classLogiSecureKeyURL.cSecureKeyUrl)
- except requests.exceptions.RequestException as e:
- print(e)
- sys.exit(1)
- # print Secure Key request URL
- print("Secure Key request URL:\n")
- print(classLogiSecureKeyURL.cSecureKeyUrl)
- print("\n\n")
- # print Secure Key
- sKey = r.text
- print("Secure Key:\n")
- print(sKey)
- return r
- # The response should be used as the rdSecureKey parameter value in HTML or Javascript in a Div or iFrame
- sKey = classLogiSecureKeyURL("http://localhost/MyNetApplicationName", "admin", "Manager", "Manager", "0.0.0.0")
- sKey.getSecureKey()