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


Python logger.info方法代碼示例

本文整理匯總了Python中logger.logger.info方法的典型用法代碼示例。如果您正苦於以下問題:Python logger.info方法的具體用法?Python logger.info怎麽用?Python logger.info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在logger.logger的用法示例。


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

示例1: getCoupon

# 需要導入模塊: from logger import logger [as 別名]
# 或者: from logger.logger import info [as 別名]
def getCoupon():
    sched_Timer="2017-06-14 20:00" ##???????
    ##????????url  ?????Network??
    couPonUrl="https://api.m.jd.com/client.action?functionId=newBabelAwardCollection&body=%7B%22activityId%22%3A%223tPzkSJZdNRuhgmowhPn7917dcq1%22%2C%22scene%22%3A%221%22%2C%22args%22%3A%22key%3D898c3948b1a44f36b032c8619e2514eb%2CroleId%3D6983488%2Cto%3Dpro.m.jd.com%2Fmall%2Factive%2F3tPzkSJZdNRuhgmowhPn7917dcq1%2Findex.html%22%2C%22mitemAddrId%22%3A%22%22%2C%22geo%22%3A%7B%22lng%22%3A%22%22%2C%22lat%22%3A%22%22%7D%7D&client=wh5&clientVersion=1.0.0&sid=dce17971eb6cbfcc2275dded296bcb58&uuid=1506710045&area=&_=1497422307569&callback=jsonp5"
    ##????????referer  ?????Network??
    referer="https://pro.m.jd.com/mall/active/3tPzkSJZdNRuhgmowhPn7917dcq1/index.html"
    while(1):
        now=datetime.datetime.now().strftime('%Y-%m-%d %H:%M');
        if now==sched_Timer:
            cj = requests.utils.cookiejar_from_dict(get_cookie())
            session.cookies = cj
            resp=session.get(
                          url=couPonUrl,
                          headers={
                         'Referer':referer ,
                       }
                        )
            logger.info(resp.text)
            break 
開發者ID:hupujrs2017,項目名稱:jingdong618,代碼行數:21,代碼來源:main.py

示例2: speech_output

# 需要導入模塊: from logger import logger [as 別名]
# 或者: from logger.logger import info [as 別名]
def speech_output(plane_data):
    logger.info('getting speech output for {}'.format(plane_data))
    output = "That's {airline_article} {airline} {aircraft}"
    route_output = " going from {depart_airport} to {arrival_airport}"

    from_airport = plane_data.get('airport_depart', None)
    to_airport = plane_data.get('airport_arrive', None)

    airline = plane_data.get('airline', 'unknown airline')
    airline_article = 'an' if airline[0] in 'aieou' else 'a'
    aircraft = plane_data['aircraft']

    formatted_output = output.format(airline_article=airline_article, airline=airline, aircraft=aircraft)
    if not from_airport or not to_airport:
        return formatted_output
    else:
        formatted_route_output = route_output.format(depart_airport=from_airport, arrival_airport=to_airport)
        return formatted_output + formatted_route_output 
開發者ID:Syps,項目名稱:alexa-airplane-spotter,代碼行數:20,代碼來源:live_speech_output.py

示例3: __init__

# 需要導入模塊: from logger import logger [as 別名]
# 或者: from logger.logger import info [as 別名]
def __init__(self, config, **kwargs):
        # basic cluster config
        self.config = config

        logger.info("ssh connection")
        user_name = get_parameters(kwargs, "user_name")
        password = get_parameters(kwargs, "password")
        private_key = get_parameters(kwargs, "private_key")
        self.ssh_clients = self.connection(user_name=user_name, password=password, private_key=private_key)

        logger.info("deploy node script, default in user's home directory")
        if user_name != "root":
            default_node_script_path = "/home/%s/node.py" % user_name
        else:
            default_node_script_path = "/root/node.py"
        self.node_script_path = get_parameters(kwargs, "node_script_path", default=default_node_script_path)
        self.deploy_node_script(self.node_script_path) 
開發者ID:yao62995,項目名稱:Renju-AI,代碼行數:19,代碼來源:deploy.py

示例4: crawl

# 需要導入模塊: from logger import logger [as 別名]
# 或者: from logger.logger import info [as 別名]
def crawl(timeout=7, n_urls=len(top500.urls), start=0):
    logger.info('starting new crawl with timeout %s n_urls %s start %s' % (timeout, n_urls, start))
    with xvfb_manager():
        driver = start_driver()
        driver.set_page_load_timeout(timeout)
        driver.set_script_timeout(timeout)

        for url in top500.urls[start:start+n_urls]:
            try:
                logger.info('visiting %s' % url)
                driver.get(url)
                sleep(timeout)
            except TimeoutException as e:
                logger.info('timeout on %s ' % url)
                driver = timeout_workaround(driver)
                continue
        data = dump_data(driver)
        driver.quit()
        return data 
開發者ID:cowlicks,項目名稱:badger-claw,代碼行數:21,代碼來源:crawler.py

示例5: send_weibo

# 需要導入模塊: from logger import logger [as 別名]
# 或者: from logger.logger import info [as 別名]
def send_weibo(self, weibo):
        if not isinstance(weibo, WeiboMessage):
            raise ValueError( 'weibo must WeiboMessage class type' )
            logger.debug( 'weibo must WeiboMessage class type' )
        if weibo.is_empty:
            return

        pids = ''
        if weibo.has_image:
            pids = self.upload_images(images)
        data = weibo.get_send_data(pids)
        self.session.headers["Referer"] = self.Referer

        try:
            resp = self.session.post(
                "http://www.weibo.com/aj/mblog/add?ajwvr=6&__rnd=%d" % int( time.time() * 1000),
                data=data
            )
            logger.info('??[%s]????' % str(weibo))
        except Exception as e:
            logger.debug(e)
            logger.info( '??[%s]????' % str(weibo) ) 
開發者ID:xxNB,項目名稱:sinaweibo_login-and-auto-Micro-blog,代碼行數:24,代碼來源:weibo_sender.py

示例6: upload_image_stream

# 需要導入模塊: from logger import logger [as 別名]
# 或者: from logger.logger import info [as 別名]
def upload_image_stream(self, image_url):
        if add_watermark:
            url = "http://picupload.service.weibo.com/interface/pic_upload.php?app=miniblog&data=1&url=" \
                + watermark_url + "&markpos=1&logo=1&nick="\
                + watermark_nike + \
                "&marks=1&mime=image/jpeg&ct=0.5079312645830214"

        else:
            url = "http://picupload.service.weibo.com/interface/pic_upload.php?rotate=0&app=miniblog&s=json&mime=image/jpeg&data=1&wm="

        # self.http.headers["Content-Type"] = "application/octet-stream"
        image_name = image_url
        try:
            f = self.session.get( image_name, timeout=30 )
            img = f.content
            resp = self.session.post( url, data=img )
            upload_json = re.search( '{.*}}', resp.text ).group(0)
            result = json.loads( upload_json )
            code = result["code"]
            if code == "A00006":
                pid = result["data"]["pics"]["pic_1"]["pid"]
                return pid
        except Exception as e:
            logger.info(u"???????%s" % image_name)
        return None 
開發者ID:xxNB,項目名稱:sinaweibo_login-and-auto-Micro-blog,代碼行數:27,代碼來源:weibo_sender.py

示例7: _poll_thread

# 需要導入模塊: from logger import logger [as 別名]
# 或者: from logger.logger import info [as 別名]
def _poll_thread(self, thread):
        """Polls 4chan thread for updates or archival"""
        time.sleep(self.sleep_per_request)
        update = thread.update()

        if update:
            logger.info("{} has {} new updates".format(thread.id, update))
            self.on_update(thread)
        else:
            logger.info("{} no updates".format(thread.id))

        if thread.archived:
            self.thread_cache.remove(thread)
            logger.info("removed {}".format(thread))
            self.on_archive(thread)

            logger.info("{} has been archived".format(thread.id)) 
開發者ID:bstarling,項目名稱:watcher-chan,代碼行數:19,代碼來源:chan_monitor.py

示例8: _fetch_new

# 需要導入模塊: from logger import logger [as 別名]
# 或者: from logger.logger import info [as 別名]
def _fetch_new(self, active_threads):
        """
        Adds new threads to thread cache
        :param active_threads: list of currently active threads
        :return: int number threads added
        """
        active_thread_ids = [t.id for t in self.thread_cache]
        processed = 0
        logger.info("Cache IDS: {}\n{}".format(active_thread_ids, len(active_thread_ids)))
        logger.info("Active threads: {}\n{}".format(active_threads, len(active_thread_ids)))
        for thread in active_threads:
            if thread not in active_thread_ids:
                self.thread_cache.append(self._fetch_one(thread))
                logger.info("{} added to thread cache".format(thread))
                processed += 1
        logger.info("Processed {} new threads".format(processed))
        return processed 
開發者ID:bstarling,項目名稱:watcher-chan,代碼行數:19,代碼來源:chan_monitor.py

示例9: nearby

# 需要導入模塊: from logger import logger [as 別名]
# 或者: from logger.logger import info [as 別名]
def nearby():
    logger.info('scanning')
    flight = get_scanner().closest()
    logger.info('chose flight {}'.format(flight))
    return scrape.flight_info(flight) if flight else None 
開發者ID:Syps,項目名稱:alexa-airplane-spotter,代碼行數:7,代碼來源:nearby.py

示例10: scrape_route_data

# 需要導入模塊: from logger import logger [as 別名]
# 或者: from logger.logger import info [as 別名]
def scrape_route_data(reg_no):
    url = route_data_endpoint.format(reg_no) #flightradar24.com/data/aircraft/{}
    logger.info("url={}".format(url))
    headers = {'user-agent': 'curl/7.38.0'} # cloudfare 418 workaround
    res = requests.get(url, headers=headers)
    route_row = most_recent_departure(BeautifulSoup(res.text, "lxml"))

    depart = route_row.findAll('td')[2].find('span').text
    depart = re.sub('[A-Z]{3}', '', depart).strip()
    arrive = route_row.findAll('td')[3].find('span').text
    arrive = re.sub('[A-Z]{3}', '', arrive).strip()

    return depart, arrive 
開發者ID:Syps,項目名稱:alexa-airplane-spotter,代碼行數:15,代碼來源:scrape.py

示例11: flight_info

# 需要導入模塊: from logger import logger [as 別名]
# 或者: from logger.logger import info [as 別名]
def flight_info(flight):
    results = db_results(flight.icao24)

    if not results:
        logger.info('could find flight in db (flight={})'.format(flight))
        return None

    reg_no, aircraft, airline = results
    aircraft = ''.join(aircraft.split('-')[:-1])

    data = {
            'aircraft': aircraft,
            'airline': airline
    }

    if not reg_no:
        logger.info('couldn\'t find aircraft icao ({}) in db'.format(flight.icao24))
        return data

    route_results = scrape_route_data(reg_no)

    if route_results:
        from_airport, to_airport = route_results
        data.update({
                     'airport_depart': from_airport,
                     'airport_arrive': to_airport
                    })
    return data 
開發者ID:Syps,項目名稱:alexa-airplane-spotter,代碼行數:30,代碼來源:scrape.py

示例12: load

# 需要導入模塊: from logger import logger [as 別名]
# 或者: from logger.logger import info [as 別名]
def load(path):
    try:
        with open(path, 'r') as reader:
            logger.info("Loading text from file %s" % path)
            return reader.read()
    except IOError as ex:
        logger.error("Could not load text from file %s - %s" % (path, ex))
        return '' 
開發者ID:ormatt,項目名稱:Guess-Genre-By-Lyrics,代碼行數:10,代碼來源:text_from_file.py

示例13: main

# 需要導入模塊: from logger import logger [as 別名]
# 或者: from logger.logger import info [as 別名]
def main():
    success = []
    failure = []
    all_bootcamps = os.listdir('./bootcamps/')
    for bootcamp_slug in all_bootcamps:
        succeeded = convert_bootcamp_data(bootcamp_slug)
        if succeeded:
            success.append(bootcamp_slug)
        else:
            failure.append(bootcamp_slug)

    logger.info(
        '[main] {} bootcamps successfully migrated. {} failures: {}'.format(
            len(success), len(failure), failure)) 
開發者ID:Thinkful,項目名稱:bootcamp-finder,代碼行數:16,代碼來源:migrate_bootcamp_data.py

示例14: run

# 需要導入模塊: from logger import logger [as 別名]
# 或者: from logger.logger import info [as 別名]
def run(self, proxies):
        # ??gevent????
        if not self.ip:
            logger.error('Validating fail, self ip is empty')
            return []
        avaliable_proxies = filter(lambda x: x, self.pool.map(self.validate, proxies))
        logger.info('Get %s avaliable proxies' % len(avaliable_proxies))
        return avaliable_proxies 
開發者ID:qqxx6661,項目名稱:Price-monitor,代碼行數:10,代碼來源:validator.py

示例15: _get_self_ip

# 需要導入模塊: from logger import logger [as 別名]
# 或者: from logger.logger import info [as 別名]
def _get_self_ip(self):
        # ??????ip
        try:
            #r = requests.get(self.http_target, headers=self.headers, timeout=5)
            #if r.ok:
                #pattern = re.compile(r'IP:port</td>\n?\s*<td.*?>([\d.]*?)(?::\d*)</td>', re.I)
                #ip = pattern.search(r.content).group(1)
                #logger.info('Get self ip success: %s' % ip)
                ip = '115.159.190.214'  # ????
                return ip
        except Exception, e:
            logger.warn('Get self ip fail, %s' % e)
            return '' 
開發者ID:qqxx6661,項目名稱:Price-monitor,代碼行數:15,代碼來源:validator.py


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