■ ■ ■ ■ ■ ■
changedetectionio/model/Watch.py
| skipped 147 lines |
148 | 148 | | bump = self.history |
149 | 149 | | return self.__newest_history_key |
150 | 150 | | |
151 | | - | # Save some text file to the appropriate path and bump the history |
152 | | - | # result_obj from fetch_site_status.run() |
153 | | - | def save_history_text(self, contents, timestamp): |
| 151 | + | def save_history_artifact(self, contents: bytes, timestamp, suffix='txt'): |
154 | 152 | | import uuid |
155 | 153 | | import logging |
156 | 154 | | |
| skipped 1 lines |
158 | 156 | | |
159 | 157 | | self.ensure_data_dir_exists() |
160 | 158 | | |
161 | | - | snapshot_fname = "{}/{}.stripped.txt".format(output_path, uuid.uuid4()) |
162 | | - | logging.debug("Saving history text {}".format(snapshot_fname)) |
| 159 | + | snapshot_fname = "{}/{}.{}".format(output_path, uuid.uuid4(), suffix) |
| 160 | + | logging.debug("Saving history artifact {}".format(snapshot_fname)) |
163 | 161 | | |
164 | 162 | | with open(snapshot_fname, 'wb') as f: |
165 | 163 | | f.write(contents) |
| skipped 92 lines |