本文整理汇总了Python中neubot.poller.POLLER.loop方法的典型用法代码示例。如果您正苦于以下问题:Python POLLER.loop方法的具体用法?Python POLLER.loop怎么用?Python POLLER.loop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neubot.poller.POLLER
的用法示例。
在下文中一共展示了POLLER.loop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from neubot.poller import POLLER [as 别名]
# 或者: from neubot.poller.POLLER import loop [as 别名]
def main(args):
''' Main function '''
try:
options, arguments = getopt.getopt(args[1:], '6A:p:Sv')
except getopt.error:
sys.exit(USAGE)
if not arguments:
sys.exit(USAGE)
prefer_ipv6 = 0
address = '127.0.0.1'
sslconfig = 0
port = 80
level = logging.INFO
for name, value in options:
if name == '-6':
prefer_ipv6 = 1
elif name == '-A':
address = value
elif name == '-p':
port = int(value)
elif name == '-S':
sslconfig = 1
elif name == '-v':
level = logging.DEBUG
logging.getLogger().setLevel(level)
handler = HttpClientSmpl(POLLER)
handler.connect((address, port), prefer_ipv6, sslconfig,
(address, port, collections.deque(arguments), [0]))
POLLER.loop()
示例2: main
# 需要导入模块: from neubot.poller import POLLER [as 别名]
# 或者: from neubot.poller.POLLER import loop [as 别名]
def main(args):
''' Run the API server '''
try:
options, arguments = getopt.getopt(args[1:], 'O:v')
except getopt.error:
sys.exit('usage: neubot background_api [-v] [-O setting]')
if arguments:
sys.exit('usage: neubot background_api [-v] [-O setting]')
settings = []
for name, value in options:
if name == '-O':
settings.append(value)
elif name == '-v':
LOG.verbose()
settings = utils_rc.parse_safe(iterable=settings)
if not 'address' in settings:
settings['address'] = '127.0.0.1 ::1'
if not 'port' in settings:
settings['port'] = '9774'
start(settings['address'], settings['port'])
POLLER.loop()
示例3: main
# 需要导入模块: from neubot.poller import POLLER [as 别名]
# 或者: from neubot.poller.POLLER import loop [as 别名]
def main(args):
''' Main function '''
try:
options, arguments = getopt.getopt(args[1:], '6A:p:v')
except getopt.error:
sys.exit('usage: neubot skype_negotiate [-6v] [-A address] [-p port]')
if arguments:
sys.exit('usage: neubot skype_negotiate [-6v] [-A address] [-p port]')
prefer_ipv6 = 0
address = '127.0.0.1'
port = 8080
level = logging.INFO
for name, value in options:
if name == '-6':
prefer_ipv6 = 1
elif name == '-A':
address = value
elif name == '-p':
port = int(value)
elif name == '-v':
level = logging.DEBUG
logging.getLogger().setLevel(level)
handler = SkypeNegotiate()
handler.connect((address, port), prefer_ipv6, 0, {})
POLLER.loop()
示例4: main
# 需要导入模块: from neubot.poller import POLLER [as 别名]
# 或者: from neubot.poller.POLLER import loop [as 别名]
def main(args):
''' Main function '''
try:
options, arguments = getopt.getopt(args[1:], '6A:p:Sv')
except getopt.error:
sys.exit('usage: neubot skype_clnt [-6Sv] [-A address] [-p port]')
if arguments:
sys.exit('usage: neubot skype_clnt [-6Sv] [-A address] [-p port]')
prefer_ipv6 = 0
address = '127.0.0.1'
port = 45678
sslconfig = False
verbose = 0
for name, value in options:
if name == '-6':
prefer_ipv6 = 1
elif name == '-A':
address = value
elif name == '-p':
port = int(value)
elif name == '-S':
sslconfig = True
elif name == '-v':
verbose += 1
level = logging.INFO
if verbose > 0:
level = logging.DEBUG
logging.getLogger().setLevel(level)
handler = SkypeClient()
handler.connect((address, port), prefer_ipv6, sslconfig, {})
POLLER.loop()
示例5: main
# 需要导入模块: from neubot.poller import POLLER [as 别名]
# 或者: from neubot.poller.POLLER import loop [as 别名]
def main(args):
''' main() function '''
try:
options, arguments = getopt.getopt(args[1:], 'vy')
except getopt.error:
sys.exit('neubot updater_runner [-vy] [version]')
if len(arguments) > 1:
sys.exit('neubot updater_runner [-vy] [version]')
privacy = False
for tpl in options:
if tpl[0] == '-v':
LOG.verbose()
elif tpl[0] == '-y':
privacy = True
# Honor -y and force privacy permissions
if privacy:
CONFIG.conf.update({'privacy.informed': 1, 'privacy.can_collect': 1,
'privacy.can_publish': 1})
updater = UpdaterRunner('win32', os.path.dirname(ROOTDIR))
if arguments:
updater.retrieve_files(arguments[0])
else:
# Enable automatic updates if we arrive here
CONFIG.conf['win32_updater'] = 1
updater.retrieve_versioninfo()
POLLER.loop()
示例6: main
# 需要导入模块: from neubot.poller import POLLER [as 别名]
# 或者: from neubot.poller.POLLER import loop [as 别名]
def main(args):
""" Main function """
try:
options, arguments = getopt.getopt(args[1:], "6A:p:Sv")
except getopt.error:
sys.exit("usage: neubot raw_clnt [-6Sv] [-A address] [-p port]")
if arguments:
sys.exit("usage: neubot raw_clnt [-6Sv] [-A address] [-p port]")
prefer_ipv6 = 0
address = "127.0.0.1"
port = 12345
sslconfig = False
verbose = 0
for name, value in options:
if name == "-6":
prefer_ipv6 = 1
elif name == "-A":
address = value
elif name == "-p":
port = int(value)
elif name == "-S":
sslconfig = True
elif name == "-v":
verbose += 1
level = logging.INFO
if verbose > 0:
level = logging.DEBUG
logging.getLogger().setLevel(level)
handler = RawClient()
handler.connect((address, port), prefer_ipv6, sslconfig, {})
POLLER.loop()
示例7: main
# 需要导入模块: from neubot.poller import POLLER [as 别名]
# 或者: from neubot.poller.POLLER import loop [as 别名]
def main(args):
''' Main() function '''
try:
options, arguments = getopt.getopt(args[1:], '')
except getopt.error:
sys.exit('usage: neubot background_win32')
if options or arguments:
sys.exit('usage: neubot background_win32')
# Read settings from database
CONFIG.merge_database(DATABASE.connection())
#
# Save logs into the database, to easily access
# and show them via the web user interface.
#
LOG.use_database()
# Complain if privacy settings are not OK
privacy.complain_if_needed()
background_api.start('127.0.0.1 ::1', '9774')
BACKGROUND_RENDEZVOUS.start()
__start_updater()
POLLER.loop()
示例8: main
# 需要导入模块: from neubot.poller import POLLER [as 别名]
# 或者: from neubot.poller.POLLER import loop [as 别名]
def main(args):
''' Main function '''
try:
options, arguments = getopt.getopt(args[1:], '6A:P:p:Sv')
except getopt.error:
sys.exit(USAGE)
if arguments:
sys.exit(USAGE)
prefer_ipv6 = 0
address = 'mlab-ns.appspot.com'
policy = ''
port = 80
sslconfig = 0
level = logging.INFO
for name, value in options:
if name == '-6':
prefer_ipv6 = 1
elif name == '-A':
address = value
elif name == '-P':
policy = value
elif name == '-p':
port = int(value)
elif name == '-S':
sslconfig = 1
elif name == '-v':
level = logging.DEBUG
logging.getLogger().setLevel(level)
handler = RunnerMlabns()
extra = {'policy': policy}
handler.connect((address, port), prefer_ipv6, sslconfig, extra)
POLLER.loop()
示例9: main
# 需要导入模块: from neubot.poller import POLLER [as 别名]
# 或者: from neubot.poller.POLLER import loop [as 别名]
def main(args):
''' main() function '''
CONFIG['verbose'] = 1
ctx = {'uri': args[1]}
RunnerDload(ctx)
POLLER.loop()
示例10: main
# 需要导入模块: from neubot.poller import POLLER [as 别名]
# 或者: from neubot.poller.POLLER import loop [as 别名]
def main(args):
""" main() function """
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
LOG.verbose()
ctx = {"uri": args[1]}
RunnerDload(ctx)
POLLER.loop()
示例11: main
# 需要导入模块: from neubot.poller import POLLER [as 别名]
# 或者: from neubot.poller.POLLER import loop [as 别名]
def main(args):
""" Main function """
try:
options, arguments = getopt.getopt(args[1:], "6A:np:vy")
except getopt.error:
sys.exit("usage: neubot skype [-6nvy] [-A address] [-p port]")
if arguments:
sys.exit("usage: neubot skype [-6nvy] [-A address] [-p port]")
prefer_ipv6 = 0
# address = 'master.neubot.org'
address = "localhost"
runner = 1
port = 8080
noisy = 0
fakeprivacy = 0
for name, value in options:
if name == "-6":
prefer_ipv6 = 1
elif name == "-A":
address = value
elif name == "-n":
runner = 0
elif name == "-p":
port = int(value)
elif name == "-v":
noisy = 1
elif name == "-y":
fakeprivacy = 1
if os.path.isfile(DATABASE.path):
DATABASE.connect()
CONFIG.merge_database(DATABASE.connection())
else:
logging.warning("skype: database file is missing: %s", DATABASE.path)
BACKEND.use_backend("null")
if noisy:
log.set_verbose()
if runner:
result = runner_clnt.runner_client(
CONFIG["agent.api.address"], CONFIG["agent.api.port"], CONFIG["verbose"], "skype"
)
if result:
sys.exit(0)
logging.info("skype: running the test in the local process context...")
if not fakeprivacy and not privacy.allowed_to_run():
privacy.complain()
logging.info("skype: otherwise use -y option to temporarily provide " "privacy permissions")
sys.exit(1)
handler = SkypeNegotiate()
handler.connect((address, port), prefer_ipv6, 0, {})
POLLER.loop()
示例12: main
# 需要导入模块: from neubot.poller import POLLER [as 别名]
# 或者: from neubot.poller.POLLER import loop [as 别名]
def main(args):
''' Main function '''
try:
options, arguments = getopt.getopt(args[1:], '6A:fp:v')
except getopt.error:
sys.exit('usage: neubot raw [-6fv] [-A address] [-p port]')
if arguments:
sys.exit('usage: neubot raw [-6fv] [-A address] [-p port]')
prefer_ipv6 = 0
address = 'master.neubot.org'
force = 0
port = 8080
noisy = 0
for name, value in options:
if name == '-6':
prefer_ipv6 = 1
elif name == '-A':
address = value
elif name == '-f':
force = 1
elif name == '-p':
port = int(value)
elif name == '-v':
noisy = 1
if os.path.isfile(DATABASE.path):
DATABASE.connect()
CONFIG.merge_database(DATABASE.connection())
else:
logging.warning('raw: database file is missing: %s', DATABASE.path)
BACKEND.use_backend('null')
if noisy:
log.set_verbose()
if not force:
result = runner_clnt.runner_client(CONFIG['agent.api.address'],
CONFIG['agent.api.port'], CONFIG['verbose'], 'raw')
if result:
sys.exit(0)
logging.warning('raw: failed to contact Neubot; is Neubot running?')
sys.exit(1)
logging.info('raw: run the test in the local process context...')
handler = RawNegotiate()
handler.connect((address, port), prefer_ipv6, 0, {})
POLLER.loop()
示例13: main
# 需要导入模块: from neubot.poller import POLLER [as 别名]
# 或者: from neubot.poller.POLLER import loop [as 别名]
def main(args):
''' Main() function '''
try:
options, arguments = getopt.getopt(args[1:], '')
except getopt.error:
sys.exit('usage: neubot background_win32')
if options or arguments:
sys.exit('usage: neubot background_win32')
# Read settings from database
CONFIG.merge_database(DATABASE.connection())
BACKEND.use_backend("neubot")
BACKEND.datadir_init()
#
# Save logs into the database, to easily access
# and show them via the web user interface.
#
LOG.use_database()
logging.info('%s for Windows: starting up', utils_version.PRODUCT)
# Complain if privacy settings are not OK
privacy.complain_if_needed()
background_api.start_api()
BACKGROUND_RENDEZVOUS.start()
__start_updater()
POLLER.loop()
logging.info('%s for Windows: shutting down', utils_version.PRODUCT)
LOG.writeback()
#
# Make sure that we do not leave the database
# in an inconsistent state.
#
DATABASE.close()
示例14: main
# 需要导入模块: from neubot.poller import POLLER [as 别名]
# 或者: from neubot.poller.POLLER import loop [as 别名]
def main(args):
''' Main() function '''
try:
options, arguments = getopt.getopt(args[1:], 'nO:vy')
except getopt.error:
sys.exit('usage: neubot background_rendezvous [-nvy] [-O setting]')
if arguments:
sys.exit('usage: neubot background_rendezvous [-nvy] [-O setting]')
notest = False
fakeprivacy = False
settings = []
for name, value in options:
if name == '-n':
notest = True
elif name == '-O':
settings.append(value)
elif name == '-v':
LOG.verbose()
elif name == '-y':
fakeprivacy = True
# Fake privacy settings
if fakeprivacy:
CONFIG.conf.update({
'privacy.informed': 1,
'privacy.can_collect': 1,
'privacy.can_publish': 1
})
if notest:
CONFIG.conf.update({'enabled': 0})
settings = utils_rc.parse_safe(iterable=settings)
if 'interval' in settings:
CONFIG.conf['agent.interval'] = settings['interval']
BACKGROUND_RENDEZVOUS.run()
POLLER.loop()
示例15: main
# 需要导入模块: from neubot.poller import POLLER [as 别名]
# 或者: from neubot.poller.POLLER import loop [as 别名]
def main(args):
''' main() function '''
try:
options, arguments = getopt.getopt(args[1:], 'C:O:vy')
except getopt.error:
sys.exit(USAGE)
if len(arguments) > 1:
sys.exit(USAGE)
sysname = 'win32'
channel = CONFIG['win32_updater_channel']
privacy = False
for tpl in options:
if tpl[0] == '-C':
channel = tpl[1]
elif tpl[0] == '-O':
sysname = tpl[1]
elif tpl[0] == '-v':
CONFIG['verbose'] = 1
elif tpl[0] == '-y':
privacy = True
# Honor -y and force privacy permissions
if privacy:
CONFIG.conf.update({'privacy.informed': 1, 'privacy.can_collect': 1,
'privacy.can_publish': 1})
CONFIG['win32_updater_channel'] = channel
updater = UpdaterRunner(sysname, utils_hier.BASEDIR)
if arguments:
updater.retrieve_files({}, arguments[0])
else:
# Enable automatic updates if we arrive here
CONFIG.conf['win32_updater'] = 1
updater.retrieve_versioninfo()
POLLER.loop()