本文整理匯總了Python中yowsup.common.tools.StorageTools.constructPath方法的典型用法代碼示例。如果您正苦於以下問題:Python StorageTools.constructPath方法的具體用法?Python StorageTools.constructPath怎麽用?Python StorageTools.constructPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類yowsup.common.tools.StorageTools
的用法示例。
在下文中一共展示了StorageTools.constructPath方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: initStore
# 需要導入模塊: from yowsup.common.tools import StorageTools [as 別名]
# 或者: from yowsup.common.tools.StorageTools import constructPath [as 別名]
def initStore(self):
self.store = LiteAxolotlStore(
StorageTools.constructPath(
self.getProp(
YowAuthenticationProtocolLayer.PROP_CREDENTIALS)[0],
self.__class__._DB
)
)
self.state = self.__class__._STATE_HASKEYS if self.store.getLocalRegistrationId() is not None \
else self.__class__._STATE_INIT
示例2: store
# 需要導入模塊: from yowsup.common.tools import StorageTools [as 別名]
# 或者: from yowsup.common.tools.StorageTools import constructPath [as 別名]
def store(self):
try:
if self._store is None:
self.store = LiteAxolotlStore(
StorageTools.constructPath(
self.getProp(
YowAuthenticationProtocolLayer.PROP_CREDENTIALS)[0],
self.__class__._DB
)
)
return self._store
except AttributeError:
return None
示例3: get_manager
# 需要導入模塊: from yowsup.common.tools import StorageTools [as 別名]
# 或者: from yowsup.common.tools.StorageTools import constructPath [as 別名]
def get_manager(self, username):
logger.debug("get_manager(username=%s)" % username)
dbpath = StorageTools.constructPath(username, self.DB)
store = LiteAxolotlStore(dbpath)
return AxolotlManager(store, username)
示例4: len
# 需要導入模塊: from yowsup.common.tools import StorageTools [as 別名]
# 或者: from yowsup.common.tools.StorageTools import constructPath [as 別名]
from yowsup_ext.layers.store import YowStorageLayer
import sys
import logging
logging.basicConfig(level = logging.DEBUG)
logger = logging.getLogger(__name__)
if __name__ == "__main__":
if len(sys.argv) < 3:
print("Usage: run.py username password")
sys.exit(1)
credentials = (sys.argv[1], sys.argv[2])
stackBuilder = YowStackBuilder()
phoneStorage = StorageTools.getStorageForPhone(credentials[0])
stackBuilder.setProp(YowStorageLayer.PROP_DB_PATH, StorageTools.constructPath(phoneStorage, "yowstore.db"))
stack = stackBuilder\
.pushDefaultLayers(True)\
.push(YowStorageLayer)\
.push(YowCleverBotLayer)\
.build()
stack.setCredentials(credentials)
logger.info("Starting")
stack.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_CONNECT))
try:
stack.loop(timeout = 0.5, discrete = 0.5)
except AuthError as e:
print("Auth Error, reason %s" % e)
except KeyboardInterrupt: