From b9d71d0b3f3e744977fd0af895451d184affe633 Mon Sep 17 00:00:00 2001 From: Kai Date: Tue, 6 Feb 2024 05:24:15 -1000 Subject: [PATCH] Change submit-archive from basic to bearer auth (#128) --- src/auto_archiver/databases/api_db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/auto_archiver/databases/api_db.py b/src/auto_archiver/databases/api_db.py index 27fab26..fd1e3c8 100644 --- a/src/auto_archiver/databases/api_db.py +++ b/src/auto_archiver/databases/api_db.py @@ -59,11 +59,11 @@ class AAApiDb(Database): logger.debug(f"saving archive of {item.get_url()} to the AA API.") payload = {'result': item.to_json(), 'public': self.public, 'author_id': self.author_id, 'group_id': self.group_id, 'tags': list(self.tags)} - response = requests.post(os.path.join(self.api_endpoint, "submit-archive"), json=payload, auth=("abc", self.api_secret)) + headers = {"Authorization": f"Bearer {self.api_secret}"} + response = requests.post(os.path.join(self.api_endpoint, "submit-archive"), json=payload, headers=headers) if response.status_code == 200: logger.success(f"AA API: {response.json()}") else: logger.error(f"AA API FAIL ({response.status_code}): {response.json()}") - \ No newline at end of file