fix/get new tomo ID

This commit is contained in:
x12sa
2026-06-30 14:31:36 +02:00
committed by holler
co-authored by holler
parent a684cfda96
commit 4e472a9a6a
@@ -253,7 +253,7 @@ class TomoIDManager:
OMNY_URL = "https://v1p0zyg2w9n2k9c1.myfritz.net/samples/newmeasurement.php"
OMNY_USER = ""
OMNY_PASSWORD = ""
TMP_FILE = "/tmp/currsamplesnr.txt"
TMP_FILE = "~/currsamplesnr.txt"
def register(
self,
@@ -295,9 +295,22 @@ class TomoIDManager:
# shell=True,
# )
#print(url)
subprocess.run(
f"wget -q -O {self.TMP_FILE} '{url}'",
tmp_file = os.path.expanduser(self.TMP_FILE)
result = subprocess.run(
f"wget -q -O {tmp_file} '{url}'",
shell=True,
)
with open(self.TMP_FILE) as f:
return int(f.read())
if result.returncode != 0:
raise OMNYToolsError(
f"wget failed (exit code {result.returncode}) fetching tomo ID from {self.OMNY_URL}"
)
try:
with open(tmp_file) as f:
content = f.read().strip()
return int(content)
except FileNotFoundError as exc:
raise OMNYToolsError(f"wget did not produce output file {tmp_file}") from exc
except ValueError as exc:
raise OMNYToolsError(
f"Unexpected response from tomo ID server, got: {content!r}"
) from exc