本文整理汇总了Python中Site.Site.download方法的典型用法代码示例。如果您正苦于以下问题:Python Site.download方法的具体用法?Python Site.download怎么用?Python Site.download使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site.Site
的用法示例。
在下文中一共展示了Site.download方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: need
# 需要导入模块: from Site import Site [as 别名]
# 或者: from Site.Site import download [as 别名]
def need(self, address, all_file=True):
from Site import Site
new = False
site = self.get(address)
if not site: # Site not exist yet
if not self.isAddress(address): return False # Not address: %s % address
logging.debug("Added new site: %s" % address)
site = Site(address)
self.sites[address] = site
if not site.settings["serving"]: # Maybe it was deleted before
site.settings["serving"] = True
site.saveSettings()
new = True
if all_file: site.download()
return site
示例2: need
# 需要导入模块: from Site import Site [as 别名]
# 或者: from Site.Site import download [as 别名]
def need(self, address, all_file=True, settings=None):
from Site import Site
site = self.get(address)
if not site: # Site not exist yet
# Try to find site with differect case
for recover_address, recover_site in self.sites.items():
if recover_address.lower() == address.lower():
return recover_site
if not self.isAddress(address):
return False # Not address: %s % address
self.log.debug("Added new site: %s" % address)
site = Site(address, settings=settings)
self.sites[address] = site
if not site.settings["serving"]: # Maybe it was deleted before
site.settings["serving"] = True
site.saveSettings()
if all_file: # Also download user files on first sync
site.download(check_size=True, blind_includes=True)
return site