本文整理匯總了Python中recorder.Recorder.write方法的典型用法代碼示例。如果您正苦於以下問題:Python Recorder.write方法的具體用法?Python Recorder.write怎麽用?Python Recorder.write使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類recorder.Recorder
的用法示例。
在下文中一共展示了Recorder.write方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: getFlightPrice
# 需要導入模塊: from recorder import Recorder [as 別名]
# 或者: from recorder.Recorder import write [as 別名]
def getFlightPrice(driver, url, id, worker_num):
"""
This function send url to remote server and get the result.
Save the result into file.
Input parameter:
dirver: The web driver.
url: type[string] . The url address.
id: type[int] The flight id.
worker_num: type[int] the worker number.
"""
# flight_module_class_name='flight-module.segment.offer-listing'
flight_id=str(id)
re = Recorder(flight_id,recorder.RecorderMode.binary)
if runDriver(driver,url,id)==True:
#Write the fight id.
flight_id="<flight_id>"+flight_id
re.writeN(flight_id)
#Write the url
re.write("<url>")
re.writeN(url)
#Write the search date
t = datetime.datetime.now().strftime("%Y-%m-%d %H %M %S")
search_date = "<search_date>"+t
re.writeN(search_date)
#Write the worker number
re.write("<worker_num>")
re.writeN(str(worker_num))
time.sleep(1)
body_element = driver.find_element_by_tag_name('body')
re.writeN(body_element.text)
time.sleep(1)
re.finish()
else:
print("worker[%d] failed to handle flight_id[%d]" %(worker_num, id))