本文整理汇总了Python中lassie.Lassie.open_graph方法的典型用法代码示例。如果您正苦于以下问题:Python Lassie.open_graph方法的具体用法?Python Lassie.open_graph怎么用?Python Lassie.open_graph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lassie.Lassie
的用法示例。
在下文中一共展示了Lassie.open_graph方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_core_class_setting_is_none
# 需要导入模块: from lassie import Lassie [as 别名]
# 或者: from lassie.Lassie import open_graph [as 别名]
def test_core_class_setting_is_none(self):
url = "http://lassie.it/core/class_setting_is_none.html"
# This is a really odd use-case where they'd set the class attr to None, but it might happen so oh wellz.
l = Lassie()
l.open_graph = None
data = l.fetch(url, open_graph=False)
self.assertEqual(len(data["images"]), 0)
示例2: test_core_class_vs_method_settings
# 需要导入模块: from lassie import Lassie [as 别名]
# 或者: from lassie.Lassie import open_graph [as 别名]
def test_core_class_vs_method_settings(self):
url = "http://lassie.it/core/class_vs_method_settings.html"
l = Lassie()
data = l.fetch(url)
self.assertEqual(len(data["images"]), 1)
l.open_graph = False
data = l.fetch(url)
# open_graph is set to False so there shouldn't be any images in the list this time around
self.assertEqual(len(data["images"]), 0)