dcc_json_toolkit.cache ¶
Internal module to interact with cache.
It is recommended not to import any of the code from this module into another project. If your project requires the direct managing of local cached 'dcc.xsd' files, then use the classes in this module at your own judgement.
Consider working directly with DccSchema
if your goal is not only to create a local file cache, but also to communicate the
data from DCC files for further operations.
CacheManager ¶
CacheManager(version: str)
Object with the purpose of managing cache files of the same version.
It is assumed that each called version has at least one file named 'dcc.xsd'
stored at https://www.ptb.de/dcc/v{version}/dcc.xsd.
The constructor creates a new folder with the same name as the value defined at the parameter 'version'. No file is automatically cached.
| Parameters: |
|
|---|
cache_xsd_file ¶
cache_xsd_file(uri: str, update_cache: bool = False, verbose: bool = False) -> Path
Caching an XSD file, as well as all imports it has.
Explores a URI of an XSD file to locally cache the file and the imports to other files. The caching of any 'dcc.xsd' file is automatically done at the constructor.
| Parameters: |
|
|---|
| Returns: |
|
|---|
purge ¶
purge(remove_folder: bool = False, verbose: bool = True)
Removes all files stored in the cache.
| Parameters: |
|
|---|
check_schema_online_file ¶
check_schema_online_file(version: str)
Checking existence of the URL for the specific XSD version.
Each versioned XSD is published at a URL https://ptb.de/dcc/v{version}/dcc.xsd,
where version is specified as following the Semantic Versioning rules.
If an incorrect version is specified, leading to a non-existing page, the link is
always redirected to 'https://www.ptb.de/cms/'.
| Raises: |
|
|---|