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

enables/disables the use of webbrowser.open() during OAuth authorization
pull/24/head
Mike Fährmann 7 years ago
parent 1a9b4759a2
commit b4c438c9ad
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

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

@ -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()
Loading…
Cancel
Save