本文整理汇总了Python中helpers.confhelper.ConfHelper.load方法的典型用法代码示例。如果您正苦于以下问题:Python ConfHelper.load方法的具体用法?Python ConfHelper.load怎么用?Python ConfHelper.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers.confhelper.ConfHelper
的用法示例。
在下文中一共展示了ConfHelper.load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from helpers.confhelper import ConfHelper [as 别名]
# 或者: from helpers.confhelper.ConfHelper import load [as 别名]
def main():
ConfHelper.load('../conf/global.conf')
parse_command_line()
if not options.mobile:
usage()
exit(1)
execute(options.mobile)
示例2: main
# 需要导入模块: from helpers.confhelper import ConfHelper [as 别名]
# 或者: from helpers.confhelper.ConfHelper import load [as 别名]
def main():
ConfHelper.load("../conf/global.conf")
parse_command_line()
if not "send" in options:
usage()
exit(1)
# domain for ydcws
# content = ':DOMAIN www.ydcws.com:10025'
# content = ':DOMAIN 211.139.215.236:10025'
# domain for ichebao.net
# content = ':DOMAIN 124.193.174.42:10025'
# content = ':DOMAIN www.ichebao.net:10025'
# content = ':DOMAIN 54.208.46.49:10027'
# for Xi'an
# content = ':DOMAIN 222.91.127.162:10024'
# for CIQ
# content = ':DOMAIN 59.37.56.145:10024'
# content = ':CQ test' # restart terminal
# content = ':CQ' # restart terminal
# content = ':REBOOT' # restart terminal
# content = ':UPDATE' # update script
# content = ':EVAL' # test script whether works well
# content = ':JB'
# content = ':SIM 13922256008:13751803006'
# content = ':SIM 18823511110:14715437523'
content = ":SIM 13600124555:14715437523"
# content = ':DW'
# content = 'test it'
# content = 'SET QQ 3*c*15241589576'
# content = u'尊敬的客户:您的定位器“14778471700”基站定位成功,地址:浙江省嘉兴市海盐县城北西路178-8号,红太阳药店附近,时间:2013-12-27,15:03:33。点击 http://www.ydcws.com/tl/nI3mUb 查看定位器位置。'
content = u"尊敬的客户:您的定位器“粤T7A711”发生震动,请关注定位器状态,地址:广东省中山市市辖 区起湾南道71,华凯花园附近,时间:2014-01-03,07:56:12。如需取消短信提醒,请执行撤防操作。点击http://www.ydcws.com/tl/Fj2MRz 查看定位器位置。onent = 尊敬的客户,您之前参加的手机阅读精品阅读包0元打折体验优惠将于本月底到期,如需退订请发送QXJPYDB到10658080、或登录手机阅读网站/客户端进行退订操作。若不退订,下月起按正常资费(5元/月)收取。精品阅读包书单详见wap.cmread.com/iread/m/M6060282 手机阅读、给你好看,感谢您的支持。中国移动"
content = "test....."
if options.send.lower() == "all":
send_all(content)
elif options.send.lower() == "one":
if not "mobile" in options:
usage()
exit(1)
elif not options.mobile:
usage()
exit(1)
# mobiles=[13703041084,13703041147,13703041294,13703041346]
# import time
# for mobile in mobiles:
# send(content, mobile)
# time.sleep(1)
send(content, options.mobile)
else:
usage()
exit(1)
示例3: main
# 需要导入模块: from helpers.confhelper import ConfHelper [as 别名]
# 或者: from helpers.confhelper.ConfHelper import load [as 别名]
def main():
tornado.options.parse_command_line()
if not ('port' in options and 'conf' in options):
import sys
usage()
sys.exit(1)
if options.mode.lower() == "debug":
debug_mode = True
else:
debug_mode = False
http_server = None
worker_pool = None
try:
ConfHelper.load(options.conf)
app = Application(debug=debug_mode)
worker_pool = WorkerPool(app.queue, int(ConfHelper.LBMP_CONF.workers))
http_server = tornado.httpserver.HTTPServer(app, xheaders=True)
http_server.listen(options.port)
logging.warn("[lbmp] running on: localhost:%d", options.port)
tornado.ioloop.IOLoop.instance().start()
except KeyboardInterrupt:
logging.error("Ctrl-C is pressed.")
except:
logging.exception("[lbmp] Exit Exception")
finally:
logging.warn("[lbmp] shutdown...")
shutdown(worker_pool, http_server)
logging.warn("[lbmp] stopped. Bye!")
示例4: __init__
# 需要导入模块: from helpers.confhelper import ConfHelper [as 别名]
# 或者: from helpers.confhelper.ConfHelper import load [as 别名]
def __init__(self, conf_file):
ConfHelper.load(conf_file)
for i in ('port', 'count'):
ConfHelper.SI_SERVER_CONF[i] = int(ConfHelper.SI_SERVER_CONF[i])
self.db = None
self.redis = None
# RabbitMQ
self.rabbitmq_connection = None
self.rabbitmq_channel = None
self.exchange = 'ydws_exchange'
self.gw_queue = '[email protected]' +\
ConfHelper.GW_SERVER_CONF.host + ':' +\
str(ConfHelper.GW_SERVER_CONF.port)
self.si_queue = '[email protected]' +\
ConfHelper.SI_SERVER_CONF.host + ':' +\
str(ConfHelper.SI_SERVER_CONF.port)
self.gw_binding = '[email protected]' +\
ConfHelper.GW_SERVER_CONF.host + ':' +\
str(ConfHelper.GW_SERVER_CONF.port)
self.si_binding = '[email protected]' +\
ConfHelper.SI_SERVER_CONF.host + ':' +\
str(ConfHelper.SI_SERVER_CONF.port)
self.heart_beat_queues = {}
self.heartbeat_threads = {}
self.connections = {}
self.addresses = {}
self.listen_fd, self.epoll_fd = self.get_socket()
self.rabbitmq_connection, self.rabbitmq_channel = self.__connect_rabbitmq(ConfHelper.RABBITMQ_CONF.host)
logging.info("[SI] Create SI request queue: %s, binding: %s",
self.si_queue, self.si_binding)
示例5: main
# 需要导入模块: from helpers.confhelper import ConfHelper [as 别名]
# 或者: from helpers.confhelper.ConfHelper import load [as 别名]
def main():
parse_command_line()
if options.mode.lower() == "debug":
debug_mode = True
else:
debug_mode = False
http_server = None
try:
ConfHelper.load(options.conf)
app = Application(debug=debug_mode)
http_server = tornado.httpserver.HTTPServer(app, xheaders=True)
thread.start_new_thread(add_sms_to_queue_thread, (app.queue,))
worker_pool = WorkerPool(app.queue, int(ConfHelper.SMS_CONF.workers))
http_server.listen(options.port)
logging.warn("[SMS] running on: localhost:%d", options.port)
tornado.ioloop.IOLoop.instance().start()
except KeyboardInterrupt:
logging.error("Ctrl-C is pressed.")
except:
logging.exception("[SMS] exit exception")
finally:
logging.warn("[SMS] shutdown...")
if http_server:
shutdown(worker_pool, http_server)
logging.warn("[SMS] Stopped. Bye!")
示例6: main
# 需要导入模块: from helpers.confhelper import ConfHelper [as 别名]
# 或者: from helpers.confhelper.ConfHelper import load [as 别名]
def main():
tornado.options.parse_command_line()
if not ('conf' in options):
import sys
usage()
sys.exit(1)
# if options.mode.lower() == "debug":
# debug_mode = True
# else:
# debug_mode = False
ConfHelper.load(options.conf)
try:
logging.warn("[CK] running on: localhost. Parent process: %s", os.getpid())
# run terminal
thread.start_new_thread(check_terminal_status, ())
thread.start_new_thread(check_service, ())
thread.start_new_thread(simulator_terminal, ())
thread.start_new_thread(simulator_terminal_test, ())
thread.start_new_thread(check_db, ())
while True:
time.sleep(60)
except KeyboardInterrupt:
logging.error("Ctrl-C is pressed.")
except:
logging.exception("[checker] Exit Exception")
finally:
logging.warn("[CK] shutdown...")
logging.warn("[CK] stopped. Bye!")
示例7: __init__
# 需要导入模块: from helpers.confhelper import ConfHelper [as 别名]
# 或者: from helpers.confhelper.ConfHelper import load [as 别名]
def __init__(self, data):
ConfHelper.load(options.conf)
data = safe_utf8(data)
length = str(len(data))
bytes = struct.pack(length + 's', data)
des_key = ConfHelper.SMS_CONF.des_key
k = des(des_key, CBC, des_key, pad=None, padmode=PAD_PKCS5)
self.result = k.encrypt(bytes)
示例8: main
# 需要导入模块: from helpers.confhelper import ConfHelper [as 别名]
# 或者: from helpers.confhelper.ConfHelper import load [as 别名]
def main():
ConfHelper.load('../conf/global.conf')
parse_command_line()
while True:
check_ncdl()
time.sleep(1)
check_zsonline()
time.sleep(300)
示例9: main
# 需要导入模块: from helpers.confhelper import ConfHelper [as 别名]
# 或者: from helpers.confhelper.ConfHelper import load [as 别名]
def main():
ConfHelper.load('../conf/global.conf')
parse_command_line()
headers = login()
while True:
check_req_to_nginx(headers)
time.sleep(1)
check_req_to_uweb(headers)
time.sleep(30)
示例10: main
# 需要导入模块: from helpers.confhelper import ConfHelper [as 别名]
# 或者: from helpers.confhelper.ConfHelper import load [as 别名]
def main():
ConfHelper.load('../conf/global.conf')
parse_command_line()
t = Test()
#test_mileage()
#t.test_acc_status()
#t.test_alarm_info()
#t.test_terminal_info()
#t.test_location()
t.test_expire()
示例11: __init__
# 需要导入模块: from helpers.confhelper import ConfHelper [as 别名]
# 或者: from helpers.confhelper.ConfHelper import load [as 别名]
def __init__(self, conf_file):
ConfHelper.load(conf_file)
for i in ('port', 'retry_interval', 'retry_count', 'recv_retry_count'):
ConfHelper.GF_CONF[i] = int(ConfHelper.GF_CONF[i])
self.__sock = None
self.is_alive = False
self.send_queue = None
self.wait_response_queue = None
self.last_check_time = None
self.login()
示例12: main
# 需要导入模块: from helpers.confhelper import ConfHelper [as 别名]
# 或者: from helpers.confhelper.ConfHelper import load [as 别名]
def main():
ConfHelper.load("../conf/global.conf")
parse_command_line()
if not "excel" in options:
usage()
exit(1)
fname = options.excel
extension = os.path.splitext(fname)[1]
if extension not in [".xlsx", ".xls"]:
print "ivalid excel file........."
else:
batch_import(fname)
示例13: main
# 需要导入模块: from helpers.confhelper import ConfHelper [as 别名]
# 或者: from helpers.confhelper.ConfHelper import load [as 别名]
def main():
ConfHelper.load('../conf/global.conf')
parse_command_line()
if not 'excel' in options:
usage()
exit(1)
fname = options.excel
extension = os.path.splitext(fname)[1]
if extension not in ['.xlsx', '.xls']:
print 'ivalid excel file.........'
else:
batch_import(fname)
示例14: main
# 需要导入模块: from helpers.confhelper import ConfHelper [as 别名]
# 或者: from helpers.confhelper.ConfHelper import load [as 别名]
def main():
ConfHelper.load('../conf/global.conf')
parse_command_line()
db = DBConnection().db
redis = MyRedis()
#tid = '35A60002B3'
tid = '36E24006A6'
location = db.get("SELECT id, speed, timestamp, category, name,"
" degree, type, latitude, longitude, clatitude, clongitude,"
" timestamp, locate_error"
" FROM T_LOCATION"
" WHERE tid = %s"
" AND type = 0"
" AND NOT (latitude = 0 AND longitude = 0)"
" ORDER BY timestamp DESC"
" LIMIT 1",
tid)
print 'location:', location
示例15: insert_sms
# 需要导入模块: from helpers.confhelper import ConfHelper [as 别名]
# 或者: from helpers.confhelper.ConfHelper import load [as 别名]
def insert_sms():
ConfHelper.load('../conf/global.conf')
parse_command_line()
db = DBConnection().db
redis = MyRedis()
msgid=str(int(time.time() * 1000))[-9:]
mobile = '18310505991'
insert_time = int(time.time() * 1000)
category = 2 # SMS.CATEGORY.MT
#send_status = -1 # SMS.SENDSTATUS.PREPARING
send_status = 0 # SMS.SENDSTATUS.SUCCESS
count = 3
for i in xrange(500):
content= 'test sms'
content = content + 'seq: %s' % i
db.execute("INSERT INTO T_SMS(msgid, mobile, content, "
" insert_time, category, send_status) "
" VALUES(%s, %s, %s, %s, %s, %s)",
msgid, mobile, content, insert_time,
category, send_status)