Skip to content
Snippets Groups Projects

Hedgedoc import

Merged Andreas Domanowski requested to merge hedgedoc-import into main
1 file
+ 2
2
Compare changes
  • Side-by-side
  • Inline
@@ -43,6 +43,8 @@ def export_from_codimd(instance_url, session_id, export_to):
target_dir = prepare_target_dir(export_to)
num_ok = num_fail = 0
print_block_heading(f"Accessing history and trying to fetch each document")
with open(Path(target_dir, f"history.json"), mode="w") as stream:
json.dump(data, stream)
print("Hold on, this may take a while...")
for row in data["history"]:
document_id = row["id"]
@@ -51,8 +53,6 @@ def export_from_codimd(instance_url, session_id, export_to):
contents = slurp(f"{document_url}/download", session_id)
with open(Path(target_dir, f"{document_id}.md"), mode="wb") as stream:
stream.write(contents)
with open(Path(target_dir, f"history.json"), mode="w") as stream:
json.dump(data, stream)
num_ok += 1
except HTTPError as error:
# history might reference deleted or otherwise inaccessible notes
Loading