本文整理汇总了Python中searcher.Searcher.start方法的典型用法代码示例。如果您正苦于以下问题:Python Searcher.start方法的具体用法?Python Searcher.start怎么用?Python Searcher.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类searcher.Searcher
的用法示例。
在下文中一共展示了Searcher.start方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SafeConfigParser
# 需要导入模块: from searcher import Searcher [as 别名]
# 或者: from searcher.Searcher import start [as 别名]
import os
from ConfigParser import SafeConfigParser
from controller import Controller
from searcher import Searcher
if __name__ == "__main__":
logging.basicConfig(
filename="log", level=logging.DEBUG, format="[%(asctime)s : %(levelname)s] [%(threadName)s] %(message)s"
)
config = SafeConfigParser()
config.read("config")
# An exception is thrown if you acces a non-existant directory,
# so we make sure they exist here
image_cache = os.path.join("cache", "images")
tweet_cache = os.path.join("cache", "tweets")
required_dirs = [image_cache, tweet_cache]
for directory in required_dirs:
if not os.path.exists(directory):
os.makedirs(directory)
# Using '' as the hostname allows the socket to bind to
# its correct address, without you needing to know exactly what
# that address is.
address = ("", config.getint("connection", "port"))
api_key = config.get("auth", "key")
api_secret = config.get("auth", "secret")
searcher = Searcher(api_key, api_secret, address)
searcher.start()
controller = Controller(searcher)
controller.start()