From bcb61cf14ede34129302c9d391a23248c3b082d9 Mon Sep 17 00:00:00 2001 From: Tom Gross Date: Fri, 3 Jan 2025 11:46:13 +0100 Subject: [PATCH] log oauth redirect server token handler --- src/pcloud/oauth2.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pcloud/oauth2.py b/src/pcloud/oauth2.py index bb44510..e97aa7c 100644 --- a/src/pcloud/oauth2.py +++ b/src/pcloud/oauth2.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import logging import _thread import time @@ -8,6 +9,9 @@ from urllib.parse import urlparse from webbrowser import open_new +log = logging.getLogger("pcloud") +log.setLevel(logging.INFO) + PORT = 65432 REDIRECT_URL = f"http://localhost:{PORT}/" @@ -63,10 +67,12 @@ def get_access_token(self): def start_server(): http_server.handle_request() + log.info(f"Start token server {PORT}") _thread.start_new_thread(start_server, ()) self.open_browser() while not (http_server.access_token and http_server.pc_hostname): time.sleep(1) self.close_browser() http_server.server_close() + log.info(f"Teardown token server {PORT}") return http_server.access_token, http_server.pc_hostname