Skip to content

Commit

Permalink
specify server
Browse files Browse the repository at this point in the history
  • Loading branch information
tschm committed May 20, 2023
1 parent 813a6f2 commit 8ddd138
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions mosek_license/license.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@
ENV_VARNAME = "MOSEKLM_LICENSE_FILE"


def upsert():
def upsert(server=None):
"""Insert or update an environment varible MOSEKLM_LICENSE_FILE"""
os.environ[ENV_VARNAME] = _url()
os.environ[ENV_VARNAME] = _url(server=server)


def current():
"""Get the current license"""
return os.environ.get(ENV_VARNAME)


def _url():
with urlopen(
f"http://localhost:8080/mosek"
) as page:
def _url(server=None):
server = server or "http://localhost:8080/mosek"
with urlopen(server) as page:
return page.read().decode("utf-8")

0 comments on commit 8ddd138

Please sign in to comment.