From 1dd0bbe1e45ec1d77ba76e94396ed4d14afdff15 Mon Sep 17 00:00:00 2001 From: James Ravenscroft Date: Sat, 19 Nov 2022 17:54:50 +0000 Subject: [PATCH] set hypothesis user env var --- hypopub.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hypopub.py b/hypopub.py index 4874bcf..48e520b 100644 --- a/hypopub.py +++ b/hypopub.py @@ -19,6 +19,8 @@ session = requests.session() token = os.getenv("MICROPUB_TOKEN") session.headers = {"Authorization": f"Bearer {token}"} +HYPOTHESIS_USER=os.getenv("HYPOTHESIS_USER") + def send_micropub(entry: atoma.atom.AtomEntry): # get the json corresponding to the annotation @@ -49,7 +51,10 @@ def send_micropub(entry: atoma.atom.AtomEntry): def main(): - response = requests.get("https://hypothes.is/stream.atom?user=ravenscroftj") + if HYPOTHESIS_USER is None: + raise Exception("You must set HYPOTHESIS_USER environment variable") + + response = requests.get(f"https://hypothes.is/stream.atom?user={HYPOTHESIS_USER}") feed = atoma.parse_atom_bytes(response.content) print(f"Processing {feed.title.value}")