本文整理汇总了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: