|
1 | 1 | import singer |
2 | | - |
| 2 | +import json |
3 | 3 | from .helpers.constants import DEFAULT_PAGE_SIZE |
4 | 4 | from .helpers import get_selected_streams, should_sync_stream, update_currently_syncing |
5 | 5 | from .helpers.datetime_utils import get_timezone_info |
@@ -30,12 +30,22 @@ def sync_endpoint(client, catalog, state, |
30 | 30 |
|
31 | 31 | return processor.process_streams_from_generators() |
32 | 32 |
|
| 33 | +def _write_config(config, config_path, _timezone): |
| 34 | + with open(config_path, encoding='utf-8') as file: |
| 35 | + config = json.load(file) |
| 36 | + |
| 37 | + config['timezone'] = _timezone |
| 38 | + with open(config_path, 'w', encoding='utf-8') as file: |
| 39 | + json.dump(config, file, indent=2) |
| 40 | + |
| 41 | + LOGGER.info("timezone has been updated in config") |
33 | 42 |
|
34 | | -def sync_all_streams(client, config, catalog, state): |
| 43 | +def sync_all_streams(client, config, config_path, catalog, state): |
35 | 44 | from .tap_generators.child_generator import ChildGenerator |
36 | 45 | from .tap_processors.child_processor import ChildProcessor |
37 | 46 |
|
38 | | - get_timezone_info(client, config_timezone=config.get("timezone")) |
| 47 | + _timezone = get_timezone_info(client) |
| 48 | + _write_config(config, config_path, _timezone) |
39 | 49 |
|
40 | 50 | selected_streams = get_selected_streams(catalog) |
41 | 51 | LOGGER.info('selected_streams: {}'.format(selected_streams)) |
|
0 commit comments