auth.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:flickr_downloader 作者: Denisolt 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号