def auth_via_browser(self, perms=u'read'):
"""Opens the webbrowser to authenticate the given request request_token, sets the verifier.
Use this method in stand-alone apps. In webapps, use auth_url(...) instead,
and redirect the user to the returned URL.
Updates the given request_token by setting the OAuth verifier.
"""
import webbrowser
# The HTTP server may have been started already, but we're not sure. Just start
# it if it needs to be started.
self._start_http_server()
url = self.auth_url(perms)
if not webbrowser.open_new_tab(url):
raise exceptions.FlickrError('Unable to open a browser to visit %s' % url)
self.verifier = self.auth_http_server.wait_for_oauth_verifier()
# We're now done with the HTTP server, so close it down again.
self._stop_http_server()
评论列表
文章目录