set hypothesis user env var

This commit is contained in:
James Ravenscroft 2022-11-19 17:54:50 +00:00
parent 7155865493
commit 1dd0bbe1e4
1 changed files with 6 additions and 1 deletions

View File

@ -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}")