use custom HTTPBasicAuth class

to support LazyPrompt as password
and to generate the Authorization header only once
instead of for every request
This commit is contained in:
Mike Fährmann
2023-12-06 23:39:23 +01:00
parent bdebe4597a
commit e256434c9e
6 changed files with 20 additions and 6 deletions

View File

@@ -423,9 +423,10 @@ class RedditAPI():
"grants/installed_client"),
"device_id": "DO_NOT_TRACK_THIS_DEVICE"}
auth = util.HTTPBasicAuth(self.client_id, "")
response = self.extractor.request(
url, method="POST", headers=self.headers,
data=data, auth=(self.client_id, ""), fatal=False)
data=data, auth=auth, fatal=False)
data = response.json()
if response.status_code != 200: