Conditions | 7 |
Total Lines | 14 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | # -*- coding: utf-8 -*- |
||
26 | def save_downloaded_xml(link, file, verify=config.get_download_verify_link()): |
||
27 | if config.get_download_use_cached_data() == True and os.path.isfile(file): |
||
28 | with open(file, 'r', encoding='utf-8') as content_file: |
||
29 | page = content_file.read() |
||
30 | else: |
||
31 | page = download_xml(link, verify) |
||
32 | if page is not None: |
||
33 | if not os.path.exists(config.get_directory_cache_url()): |
||
34 | os.makedirs(config.get_directory_cache_url()) |
||
35 | with open(file, mode='w', encoding='utf-8') as code: |
||
36 | code.write(page.decode('utf-8')) |
||
37 | else: |
||
38 | logging.warning('Skipping dataset.') |
||
39 | return page |
||
40 |