Readme and implementation changes

Added optional auth url callback
Removed user pass from readme
Added oauth to readme
This commit is contained in:
werwolf2303
2025-06-11 11:30:52 +02:00
parent f210850bee
commit 22e6419bc9
3 changed files with 46 additions and 6 deletions

View File

@@ -1596,10 +1596,16 @@ class Session(Closeable, MessageListener, SubListener):
pass
return self
def oauth(self) -> Session.Builder:
def oauth(self, oauth_url_callback) -> Session.Builder:
"""
Login via OAuth
You can supply an oauth_url_callback method that takes a string and returns the OAuth URL.
When oauth_url_callback is None, this will block until logged in.
"""
if os.path.isfile(self.conf.stored_credentials_file):
return self.stored_file(None)
self.login_credentials = OAuth(MercuryRequests.keymaster_client_id, "http://127.0.0.1:5588/login").flow()
self.login_credentials = OAuth(MercuryRequests.keymaster_client_id, "http://127.0.0.1:5588/login", oauth_url_callback).flow()
return self
def user_pass(self, username: str, password: str) -> Session.Builder: