summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2022-01-20 17:05:04 -0500
committerGlenn Smith <glenn@vector35.com>2022-01-20 17:06:08 -0500
commit836848724094f8ae98c31c886ca827a41a366b21 (patch)
treea2b758734841ecf41a105a1c15b11b21bf055ca5 /python
parenta0181651c332a9f9fa586dfb10f628eea16a8428 (diff)
[Enterprise] APIs for get/set server url
Diffstat (limited to 'python')
-rw-r--r--python/enterprise.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/python/enterprise.py b/python/enterprise.py
index 1d9743a1..18062153 100644
--- a/python/enterprise.py
+++ b/python/enterprise.py
@@ -110,6 +110,25 @@ def token() -> Optional[str]:
return value
+def server_url() -> str:
+ """
+ Get the url of the Enterprise Server.
+ :return: The current url
+ """
+ return core.BNGetEnterpriseServerUrl()
+
+
+def set_server_url(url: str):
+ """
+ Set the url of the Enterprise Server.
+ .. note:: This will raise an Exception if the server is already initialized
+
+ :param url: New Enterprise Server url
+ """
+ if not core.BNSetEnterpriseServerUrl(url):
+ raise RuntimeError(last_error())
+
+
def server_name() -> Optional[str]:
"""
Get the display name of the currently connected server
@@ -230,6 +249,14 @@ def last_error() -> str:
return core.BNGetEnterpriseServerLastError()
+def is_initialized() -> bool:
+ """
+ Determine if the Enterprise Client has been initialized yet.
+ :return: True if any other Enterprise methods have been called
+ """
+ return core.BNIsEnterpriseServerInitialized()
+
+
class LicenseCheckout:
"""
Helper class for scripts to make use of a license checkout in a scope.