本文整理汇总了Python中dumptruck.DumpTruck.get_var方法的典型用法代码示例。如果您正苦于以下问题:Python DumpTruck.get_var方法的具体用法?Python DumpTruck.get_var怎么用?Python DumpTruck.get_var使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dumptruck.DumpTruck
的用法示例。
在下文中一共展示了DumpTruck.get_var方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: savegetvar
# 需要导入模块: from dumptruck import DumpTruck [as 别名]
# 或者: from dumptruck.DumpTruck import get_var [as 别名]
def savegetvar(self, var):
h = DumpTruck(dbname = '/tmp/test.db')
h.save_var(u'weird', var)
h.close()
h = DumpTruck(dbname = '/tmp/test.db')
t=os.stat('/tmp/test.db').st_mtime
self.assertEqual(h.get_var(u'weird'), var)
h.close()
assert os.stat('/tmp/test.db').st_mtime==t
示例2: savegetvar
# 需要导入模块: from dumptruck import DumpTruck [as 别名]
# 或者: from dumptruck.DumpTruck import get_var [as 别名]
def savegetvar(self, var):
h = DumpTruck(dbname="/tmp/test.db")
h.save_var(u"weird", var)
h.close()
h = DumpTruck(dbname="/tmp/test.db")
t = os.stat("/tmp/test.db").st_mtime
self.assertEqual(h.get_var(u"weird"), var)
h.close()
assert os.stat("/tmp/test.db").st_mtime == t
示例3: get
# 需要导入模块: from dumptruck import DumpTruck [as 别名]
# 或者: from dumptruck.DumpTruck import get_var [as 别名]
def get(self, key, value):
h = DumpTruck(dbname = u'/tmp/test.db')
self.assertEqual(h.get_var(key), value)
h.close()
示例4: savegetvar
# 需要导入模块: from dumptruck import DumpTruck [as 别名]
# 或者: from dumptruck.DumpTruck import get_var [as 别名]
def savegetvar(self, var):
h = DumpTruck(dbname = '/tmp/test.db')
h.save_var(u'weird', var)
self.assertEqual(h.get_var(u'weird'), var)
h.close()
示例5: reference
# 需要导入模块: from dumptruck import DumpTruck [as 别名]
# 或者: from dumptruck.DumpTruck import get_var [as 别名]
kin = {"kwargs": cb.kwargs}
kin.update(reference)
dt.insert(kin, cb.bucket)
# The first entry has no ancestors, so it has to make its own entry.
if self.motherbucket == None:
dt.insert({"scraper_run": scraper_run, "kwargs": self.kwargs}, self.bucket)
return childbuckets
def reference(self):
# For linking scraped data to this row
return {"kwargs": self.kwargs, "motherkwargs": self.motherkwargs, "scraper_run": scraper_run}
try:
scraper_run = dt.get_var("scraper_run")
except:
scraper_run = datetime.date.today().isoformat()
dt.save_var("scraper_run", scraper_run)
def excavate(bucketclasses=[], startingbuckets=[]):
"Start everything."
# Bucket classes (page types)
if bucketclasses == []:
for g in globals().values():
if isinstance(g, BucketMold) and g != BucketMold:
bucketclasses.append(g)
bag = Bag(buckets=bucketclasses)