本文整理汇总了Python中pit.Pit.set方法的典型用法代码示例。如果您正苦于以下问题:Python Pit.set方法的具体用法?Python Pit.set怎么用?Python Pit.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pit.Pit
的用法示例。
在下文中一共展示了Pit.set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from pit import Pit [as 别名]
# 或者: from pit.Pit import set [as 别名]
def main():
gmail = Pit.get('gmail', {'require' : {
'user' : 'Gmail account name',
'pass' : 'password for Gmail account',
'fullcount' : '0'
}})
kayac = Pit.get('kayac', {'require' : {
'user' : 'im.kayac.com account name',
'pass' : 'password for im.kayac.com account'
}})
d = feedparser.parse( GMAILATOM % (gmail['user'], gmail['pass']) )
if int(d.feed.fullcount) == int(gmail['fullcount']):
sys.exit(0)
elif int(d.feed.fullcount) > int(gmail['fullcount']):
for e in d.entries:
title = e.title
author = e.author
message = '%s <%s> [%[email protected]]' % (title, author, gmail['user'])
r = notify(message, kayac['user'], kayac['pass'])
if r['result'] != 'posted':
print 'failed', r
sys.exit(2)
Pit.set('gmail', {'data' : {
'user' : gmail['user'],
'pass' : gmail['pass'],
'fullcount' : str(d.feed.fullcount)}})
示例2: test_set_get
# 需要导入模块: from pit import Pit [as 别名]
# 或者: from pit.Pit import set [as 别名]
def test_set_get(self):
Pit.set("test", {'data':{'username':'foo','password':'bar'}})
self.assertEqual("foo", Pit.get("test")["username"] )
self.assertEqual("bar", Pit.get("test")["password"] )
Pit.set("test2", {'data' : {"username":"foo2","password":"bar2"}})
self.assertEqual( "foo2", Pit.get("test2")["username"])
self.assertEqual( "bar2", Pit.get("test2")["password"])
Pit.set("test", {'data' : {"username":"foo","password":"bar"}})
self.assertEqual( "foo", Pit.get("test")["username"])
self.assertEqual( "bar", Pit.get("test")["password"])
self.assertEqual( "foo", Pit.set("test",{'data':{"username":"foo","password":"bar"}})["username"])
示例3: set
# 需要导入模块: from pit import Pit [as 别名]
# 或者: from pit.Pit import set [as 别名]
def set():
Pit.set('test1', dict(data=data))
示例4:
# 需要导入模块: from pit import Pit [as 别名]
# 或者: from pit.Pit import set [as 别名]
#!/usr/bin/env python
#-*- coding:utf8 -*-
from pit import Pit
conf = Pit.set('fb_app_info', {'require':{'app_id':'','consumer_secret':''}})