本文整理汇总了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
示例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
示例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)
示例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
示例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) )
示例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
示例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))
示例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
示例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
示例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
示例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
示例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 ''
示例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))
示例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
示例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 ''