implement copying tags + hypothesis metadata

This commit is contained in:
James Ravenscroft 2022-11-20 09:56:03 +00:00
parent 676a2e876a
commit 2f34a0deba
1 changed files with 7 additions and 2 deletions

View File

@ -37,17 +37,22 @@ def send_micropub(entry: atoma.atom.AtomEntry):
endpoint = os.getenv("MICROPUB_ENDPOINT") endpoint = os.getenv("MICROPUB_ENDPOINT")
session.post(f"{endpoint}", json={ r = session.post(f"{endpoint}", json={
"type": ["h-entry"], "type": ["h-entry"],
"properties":{ "properties":{
"published": [entry.published.strftime("%Y-%m-%dT%H:%M:%S")], "published": [entry.published.strftime("%Y-%m-%dT%H:%M:%S")],
"content":[{ "content":[{
"html": entry.content.value "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(): def main():