diff --git a/hypopub.py b/hypopub.py index 48e520b..222d6e7 100644 --- a/hypopub.py +++ b/hypopub.py @@ -37,17 +37,22 @@ def send_micropub(entry: atoma.atom.AtomEntry): endpoint = os.getenv("MICROPUB_ENDPOINT") - session.post(f"{endpoint}", json={ + r = session.post(f"{endpoint}", json={ "type": ["h-entry"], "properties":{ "published": [entry.published.strftime("%Y-%m-%dT%H:%M:%S")], "content":[{ "html": entry.content.value }], - "in-reply-to": [annotation['target'][0]['source']] + "category": annotation['tags'] + ['hypothes.is'], + "in-reply-to": [annotation['target'][0]['source']], + "hypothesis-link": [json_link] } }) + if r.status_code > 300: + raise Exception(f"Request failed: {r.status_code}: {r.text}") + def main():