# -*- coding: utf-8 -*-
"""Code to access static data in the NeDRex API
"""
from typing import Any as _Any
from typing import Dict as _Dict
from typing import Optional as _Optional
from nedrex import config as _config
from nedrex._common import check_response as _check_response
from nedrex._common import download_file as _download_file
from nedrex._common import http as _http
[docs]def get_license() -> str:
"""Obtain the NeDRex license
Returns
-------
str
The text of the NeDRex license.
"""
url = f"{_config.url_base}/static/licence"
resp = _http.get(url)
result: str = _check_response(resp=resp, return_type="text")
return result
[docs]def download_lengths_map(target: _Optional[str] = None) -> None:
"""Obtains the lengths.map file
The lengths.map file is required for some versions of the NeDRex app.
Parameters
----------
target : str, optional
The file location to save the file, with the default being lengths.map
in the current directory.
"""
if target is None:
target = "lengths.map"
url = f"{_config.url_base}/static/lengths.map"
_download_file(url, target)