From 2e879949f55bbfe2e44c118bf7037035bf481b5c Mon Sep 17 00:00:00 2001 From: Ali Parlakci Date: Sat, 27 Mar 2021 23:17:37 +0300 Subject: [PATCH] Send HTTP200 when oauth2 is successful --- bulkredditdownloader/oauth2.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bulkredditdownloader/oauth2.py b/bulkredditdownloader/oauth2.py index 9678b45..b8ec2c4 100644 --- a/bulkredditdownloader/oauth2.py +++ b/bulkredditdownloader/oauth2.py @@ -62,6 +62,7 @@ class OAuth2Authenticator: self.send_message(client) raise RedditAuthenticationError(f'Error in OAuth2: {params["error"]}') + self.send_message(client, "") refresh_token = reddit.auth.authorize(params["code"]) return refresh_token @@ -80,8 +81,8 @@ class OAuth2Authenticator: return client @staticmethod - def send_message(client: socket.socket): - client.send('HTTP/1.1 200 OK'.encode('utf-8')) + def send_message(client: socket.socket, message: str): + client.send(f'HTTP/1.1 200 OK\r\n\r\n{message}'.encode('utf-8')) client.close()