本文整理汇总了Python中thumbor.config.Config.HTTP_LOADER_FORWARD_USER_AGENT方法的典型用法代码示例。如果您正苦于以下问题:Python Config.HTTP_LOADER_FORWARD_USER_AGENT方法的具体用法?Python Config.HTTP_LOADER_FORWARD_USER_AGENT怎么用?Python Config.HTTP_LOADER_FORWARD_USER_AGENT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thumbor.config.Config
的用法示例。
在下文中一共展示了Config.HTTP_LOADER_FORWARD_USER_AGENT方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: topic
# 需要导入模块: from thumbor.config import Config [as 别名]
# 或者: from thumbor.config.Config import HTTP_LOADER_FORWARD_USER_AGENT [as 别名]
def topic(self, callback):
url = self.get_url('/')
loader.http_client = self._http_client
config = Config()
config.HTTP_LOADER_FORWARD_USER_AGENT = True
ctx = Context(None, config, None, HandlerMock({"User-Agent": "test-user-agent"}))
loader.load(ctx, url, callback)
示例2: test_load_with_user_agent
# 需要导入模块: from thumbor.config import Config [as 别名]
# 或者: from thumbor.config.Config import HTTP_LOADER_FORWARD_USER_AGENT [as 别名]
def test_load_with_user_agent(self):
url = self.get_url('/')
config = Config()
config.HTTP_LOADER_FORWARD_USER_AGENT = True
ctx = Context(None, config, None, HandlerMock({"User-Agent": "test-user-agent"}))
loader.load(ctx, url, self.stop)
result = self.wait()
expect(result).to_be_instance_of(LoaderResult)
expect(result.buffer).to_equal('test-user-agent')
示例3: test_load_with_default_user_agent
# 需要导入模块: from thumbor.config import Config [as 别名]
# 或者: from thumbor.config.Config import HTTP_LOADER_FORWARD_USER_AGENT [as 别名]
def test_load_with_default_user_agent(self):
url = self.get_url("/")
config = Config()
config.HTTP_LOADER_FORWARD_USER_AGENT = True
config.HTTP_LOADER_DEFAULT_USER_AGENT = "DEFAULT_USER_AGENT"
ctx = Context(None, config, None, HandlerMock({}))
loader.load(ctx, url, self.stop)
result = self.wait()
expect(result).to_be_instance_of(LoaderResult)
expect(result.buffer).to_equal("DEFAULT_USER_AGENT")