1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 18:53:21 +01:00

[oauth] add the 'extractor.oauth.browser' option

enables/disables the use of webbrowser.open() during OAuth authorization
This commit is contained in:
Mike Fährmann 2017-06-20 16:06:14 +02:00
parent 1a9b4759a2
commit b4c438c9ad
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 3 additions and 2 deletions

View File

@ -73,7 +73,7 @@ modules = [
"imagehosts",
"directlink",
"recursive",
"oauthhelper",
"oauth",
"test",
]

View File

@ -65,7 +65,8 @@ class OAuthBase(Extractor):
"""Open 'url' in browser amd return response parameters"""
import webbrowser
url += "?" + urllib.parse.urlencode(params)
if not webbrowser.open(url):
browser = self.config("browser", True)
if not browser or (browser and not webbrowser.open(url)):
print("Please open this URL in your browser:")
print(url, end="\n\n", flush=True)
return self.recv()