當前位置: 首頁>>代碼示例>>Python>>正文


Python Pit.set方法代碼示例

本文整理匯總了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)}})
開發者ID:ymotongpoo,項目名稱:0x7d8,代碼行數:35,代碼來源:gmail2kayac.py

示例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"])
開發者ID:yoshiori,項目名稱:pit,代碼行數:16,代碼來源:test.py

示例3: set

# 需要導入模塊: from pit import Pit [as 別名]
# 或者: from pit.Pit import set [as 別名]
def set():
	Pit.set('test1', dict(data=data))
開發者ID:a-yasui,項目名稱:atysPy,代碼行數:4,代碼來源:pit_test.py

示例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':''}})


開發者ID:tell-k,項目名稱:code-snippets,代碼行數:7,代碼來源:setup.py


注:本文中的pit.Pit.set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。