Browse Source

Add back try/catch to match dhtml code block

main
Luke Murphy 4 years ago
parent
commit
6cd15a6256
No known key found for this signature in database GPG Key ID: 5E2EF5A63E3718CC
  1. 6
      etherpump/commands/pull.py

6
etherpump/commands/pull.py

@ -470,6 +470,7 @@ async def handle_pad(args, padid, data, info, session):
downloaded_html = True
if html["_code"] == 200:
try:
html_body = html["data"]["html"]
ver["path"] = p + ".raw.html"
ver["url"] = quote(ver["path"])
@ -486,6 +487,8 @@ async def handle_pad(args, padid, data, info, session):
async with await trio.open_file(ver["path"], "w") as f:
output = ET.tostring(doc, method="html", encoding="unicode")
await f.write(output)
except TypeError:
ver["message"] = html["message"]
if args.all or args.magicwords:
if not downloaded_html:
@ -495,6 +498,7 @@ async def handle_pad(args, padid, data, info, session):
ver["code"] = html["_code"]
if html["_code"] == 200:
try:
html_body = html["data"]["html"]
ver["path"] = p + ".magicwords.html"
ver["url"] = quote(ver["path"])
@ -517,6 +521,8 @@ async def handle_pad(args, padid, data, info, session):
async with await trio.open_file(ver["path"], "w") as f:
output = ET.tostring(doc, method="html", encoding="unicode")
await f.write(output)
except TypeError:
ver["message"] = html["message"]
# output meta
if args.all or args.meta:

Loading…
Cancel
Save