handler.py 文件源码

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

项目:Liljimbo-Chatbot 作者: chrisjim316 项目源码 文件源码
def get_strategy_for(self, url):
        """Retrieve the authentication strategy for a specified URL.

        :param str url: The full URL you will be making a request against. For
            example, ``'https://api.github.com/user'``
        :returns: Callable that adds authentication to a request.

        .. code-block:: python

            import requests
            a = AuthHandler({'example.com', ('foo', 'bar')})
            strategy = a.get_strategy_for('http://example.com/example')
            assert isinstance(strategy, requests.auth.HTTPBasicAuth)

        """
        key = self._key_from_url(url)
        return self.strategies.get(key, NullAuthStrategy())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号