當前位置: 首頁>>代碼示例>>Python>>正文


Python confhelper.ConfHelper類代碼示例

本文整理匯總了Python中helpers.confhelper.ConfHelper的典型用法代碼示例。如果您正苦於以下問題:Python ConfHelper類的具體用法?Python ConfHelper怎麽用?Python ConfHelper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ConfHelper類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

def main():
    ConfHelper.load('../conf/global.conf')
    parse_command_line()
    if not options.mobile:
        usage()
        exit(1)
    execute(options.mobile)
開發者ID:jcsy521,項目名稱:ydws,代碼行數:7,代碼來源:delete_terminal.py

示例2: main

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)
開發者ID:jcsy521,項目名稱:ydws,代碼行數:60,代碼來源:send_sms.py

示例3: main

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!")
開發者ID:jcsy521,項目名稱:ydws,代碼行數:32,代碼來源:server.py

示例4: __init__

    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)
開發者ID:jcsy521,項目名稱:ydws,代碼行數:32,代碼來源:mysiserver.py

示例5: main

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!")
開發者ID:jcsy521,項目名稱:ydws,代碼行數:30,代碼來源:server.py

示例6: main

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!")
開發者ID:jcsy521,項目名稱:ydws,代碼行數:32,代碼來源:server.py

示例7: __init__

 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)
開發者ID:jcsy521,項目名稱:ydws,代碼行數:8,代碼來源:des.py

示例8: main

def main():
    ConfHelper.load('../conf/global.conf')
    parse_command_line()
    
    while True:
        check_ncdl()
        time.sleep(1)
        check_zsonline()
        time.sleep(300)
開發者ID:jcsy521,項目名稱:ydws,代碼行數:9,代碼來源:zsweb_checker.py

示例9: main

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)
開發者ID:jcsy521,項目名稱:ydws,代碼行數:11,代碼來源:uweb_checker.py

示例10: main

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() 
開發者ID:jcsy521,項目名稱:ydws,代碼行數:12,代碼來源:test_redis.py

示例11: __init__

    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()
開發者ID:jcsy521,項目名稱:ydws,代碼行數:12,代碼來源:base.py

示例12: main

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)
開發者ID:jcsy521,項目名稱:ydws,代碼行數:13,代碼來源:polly_bindlog.py

示例13: main

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) 
開發者ID:jcsy521,項目名稱:ydws,代碼行數:13,代碼來源:import_whitelist.py

示例14: main

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
開發者ID:jcsy521,項目名稱:ydws,代碼行數:19,代碼來源:mydb.py

示例15: insert_sms

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) 
開發者ID:jcsy521,項目名稱:ydws,代碼行數:22,代碼來源:test_sms.py


注:本文中的helpers.confhelper.ConfHelper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。