|
13 | 13 | from queue import Queue |
14 | 14 | from threading import Thread |
15 | 15 | from typing import Awaitable, Callable, Dict, List, Optional, Tuple, Union |
16 | | -from urllib.parse import ParseResult, urlparse, urlunparse |
| 16 | +from urllib.parse import urlparse, urlunparse |
17 | 17 | from uuid import uuid4 |
18 | 18 |
|
19 | 19 | import requests |
20 | 20 | from werkzeug.utils import secure_filename |
21 | 21 |
|
22 | | -from murfey.util.models import Visit |
23 | | - |
24 | 22 | logger = logging.getLogger("murfey.util") |
25 | 23 |
|
26 | 24 |
|
@@ -98,24 +96,6 @@ def posix_path(path: Path) -> str: |
98 | 96 | return str(path) |
99 | 97 |
|
100 | 98 |
|
101 | | -@lru_cache(maxsize=1) |
102 | | -def get_machine_config(url: str, instrument_name: str = "", demo: bool = False) -> dict: |
103 | | - _instrument_name: str | None = instrument_name or os.getenv("BEAMLINE") |
104 | | - if not _instrument_name: |
105 | | - return {} |
106 | | - return requests.get(f"{url}/instruments/{_instrument_name}/machine").json() |
107 | | - |
108 | | - |
109 | | -def _get_visit_list(api_base: ParseResult, instrument_name: str): |
110 | | - get_visits_url = api_base._replace( |
111 | | - path=f"/instruments/{instrument_name}/visits_raw" |
112 | | - ) |
113 | | - server_reply = requests.get(get_visits_url.geturl()) |
114 | | - if server_reply.status_code != 200: |
115 | | - raise ValueError(f"Server unreachable ({server_reply.status_code})") |
116 | | - return [Visit.parse_obj(v) for v in server_reply.json()] |
117 | | - |
118 | | - |
119 | 99 | def capture_post(url: str, json: dict | list = {}) -> requests.Response | None: |
120 | 100 | try: |
121 | 101 | response = requests.post(url, json=json) |
|
0 commit comments