def __init__(self): logging.config.fileConfig(myglobal.LOGGINGINI) self.__logger = logging.getLogger('htmlparser') c = configuration.configuration() c.fileConfig(myglobal.CONFIGURATONINI) self.__RETRY_TIMES__ = int(c.getValue("Runtime", "retry_times")) self.__PAGE_INTERVAL__ = int(c.getValue("Runtime", "page_interval"))
def __init__(self): logging.config.fileConfig(myglobal.LOGGINGINI) self.__logger = logging.getLogger('dingapi') self.__c = configuration.configuration() self.__c.fileConfig(myglobal.CONFIGURATONINI) self.__h = httpconnect.httpconnect() self.__token = self.__genToken(self.__c.getValue("Ding", "corpid"), self.__c.getValue("Ding", "corpsecret"))
def __init__(self): logging.config.fileConfig(myglobal.LOGGINGINI) self.__logger = logging.getLogger('grab') self.__c = configuration.configuration() self.__c.fileConfig(myglobal.CONFIGURATONINI) self.__RETRY_TIMES__ = int(self.__c.getValue("Runtime","retry_times")) self.__f = formpage.formpage() self.__h = htmlparser.htmlpaser() self.__j = jsonpost.jsonpost() self.__js = jspost.jspost() self.__taskID = "" self.__methodNotify = ""
def __init__(self): ''' Latest build of certain component is retrieved on initialization ''' self.__config = configuration.configuration() logging.config.fileConfig(myglobal.LOGGINGINI) self.__logger = logging.getLogger('monitor') if os.path.exists(self.__queue_file) == False: os.system(r'touch %s' % self.__queue_file) self.__config.fileConfig(myglobal.CONFIGURATONINI) self._db = None self._initData()
def __init__(self): #self.__pageinfo = "" # Browser self.__br = mechanize.Browser() self.__br_i = mechanize.Browser() #self.__br = mechanize.urlopen("https://taobao.com") # Cookie Jar cj = cookielib.LWPCookieJar() self.__br.set_cookiejar(cj) self.__br_i.set_cookiejar(cj) # Browser options self.__br.set_handle_equiv(True) self.__br.set_handle_gzip(True) self.__br.set_handle_redirect(True) self.__br.set_handle_referer(True) self.__br.set_handle_robots(False) # Browser options self.__br_i.set_handle_equiv(True) self.__br_i.set_handle_gzip(True) self.__br_i.set_handle_redirect(True) self.__br_i.set_handle_referer(True) self.__br_i.set_handle_robots(False) # Follows refresh 0 but not hangs on refresh > 0 self.__br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1) # Follows refresh 0 but not hangs on refresh > 0 self.__br_i.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1) # Want debugging messages? #br.set_debug_http(True) #br.set_debug_redirects(True) #br.set_debug_responses(True) # User-Agent (this is cheating, ok?) self.__br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')] self.__br_i.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')] logging.config.fileConfig(myglobal.LOGGINGINI) self.__logger = logging.getLogger('formpage') c = configuration.configuration() c.fileConfig(myglobal.CONFIGURATONINI) self.__RETRY_TIMES__ = int(c.getValue("Runtime","retry_times")) self.__PAGE_INTERVAL__ = int(c.getValue("Runtime","page_interval")) self.__h = htmlparser.htmlpaser()
def __initFolderNFile(self,folders): folder_list = folders.split("/") folder = "" for sub_folder in folder_list: folder = folder + sub_folder if os.path.exists(folder) is not True: os.system("mkdir %s" %folder) folder = folder + "/" ''' name = self.__taskID+ "_" + self.__c.getValue(self.__taskID,"name") if os.path.exists(__RESOURCE_FOLDER__ + "/" + name) is not True: os.system("mkdir %s" %(__RESOURCE_FOLDER__ + "/" + name)) ''' c_info = configuration.configuration() file_info = folder + __FILE_INFO__ c_info.fileConfig(file_info) url = self.__c.getValue(self.__taskID,"url") c_info.setValue("Info","url",self.__genFirstPageUrl(url)) name = self.__c.getValue(self.__taskID,"name") c_info.setValue("Info","name",name) ISOTIMEFORMAT= '%Y-%m-%d %X' c_info.setValue("Info","timestamp",time.strftime(ISOTIMEFORMAT,time.localtime()))
if uid is None: sys.exit(0) if port is None: sys.exit(0) if bport is None: sys.exit(0) # verify if device is connected devices = library.get_connected_devices() if uid not in devices: print "Device is not connected, please check" sys.exit(0) try: # verify if device is configuration config = configuration.configuration() config.fileConfig(myglobal.CONFIGURATONINI) config.setValue(uid, 'port', str(port)) except Exception, ex: print "There is no related configuration information" sys.exit(0) try: pid = 0 filename = library.get_log_name(uid) config.setValue(uid, 'logname', filename) fileobj = file(filename, 'a+') status, appium_process = library.launch_appium(uid, port, bport) pid = appium_process.pid if status == "READY": # test_schedule.init_device_environment(uid,port,test_logger,filename)