Extracts the serial number from the license specified in path :param path: path to license file :type path: str :raises ValueError: When no headless license is found in the provided license.dat :return: returns the serial number of the headless license :rtype: str
(path: str)
| 33 | |
| 34 | |
| 35 | def get_serial_from_license(path: str) -> str: |
| 36 | """Extracts the serial number from the license specified in path |
| 37 | |
| 38 | :param path: path to license file |
| 39 | :type path: str |
| 40 | :raises ValueError: When no headless license is found in the provided license.dat |
| 41 | :return: returns the serial number of the headless license |
| 42 | :rtype: str |
| 43 | """ |
| 44 | with open(path) as f: |
| 45 | for license in [l for l in json.load(f) if 'Headless' in l['product']]: |
| 46 | return license['serial'] |
| 47 | raise ValueError(f'No "Headless" license in {path}') |
| 48 | |
| 49 | |
| 50 | def download_headless(serial: str, output_path: str = None, dev: bool = False) -> str: |
no test coverage detected