本文整理汇总了Python中Server.Server.get方法的典型用法代码示例。如果您正苦于以下问题:Python Server.get方法的具体用法?Python Server.get怎么用?Python Server.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Server
的用法示例。
在下文中一共展示了Server.get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_loan_list
# 需要导入模块: from Server import Server [as 别名]
# 或者: from Server.Server import get [as 别名]
def get_loan_list(url, cache, use_cookie=False):
""" 获取散标列表, 返回列表 """
domain = PaipaiDai.get_domain(url)
data, cache = Server.get(url, cache=cache, use_cookie=use_cookie)
if data:
data, next_page = Analyzer.get_loan_list(data)
if next_page:
next_page = os.path.join(domain, next_page.lstrip('/'))
return data, next_page, cache
return [], None, False
示例2: __get_buy_loans2
# 需要导入模块: from Server import Server [as 别名]
# 或者: from Server.Server import get [as 别名]
def __get_buy_loans2(self, url):
domain = PaipaiDai.get_domain(url)
content, cache = Server.get(url, cache=False, use_cookie=True)
if content:
my_loans, next_page = Analyzer.get_my_loan_list(content)
self.db.insert_my_loans(my_loans)
print url
if next_page:
if not cache:
time.sleep(2)
next_page = os.path.join(domain, next_page.lstrip('/'))
self.__get_buy_loans2(next_page)
else:
time.sleep(2)
示例3: get_bond_list
# 需要导入模块: from Server import Server [as 别名]
# 或者: from Server.Server import get [as 别名]
def get_bond_list(url, total_page=1):
""" 获取债券列表 """
domain = PaipaiDai.get_domain(url)
bonds = []
try:
data, cache = Server.get(url, cache=False)
if data:
data, next_page = Analyzer.get_bond_list(data)
bonds.extend(data)
if next_page and total_page > 1:
next_page = os.path.join(domain, next_page.lstrip('/'))
PaipaiDai.get_best_bond(next_page, total_page-1)
except Exception, e:
print e
示例4: get_loan_all_list
# 需要导入模块: from Server import Server [as 别名]
# 或者: from Server.Server import get [as 别名]
def get_loan_all_list(url, total_page=1):
""" 获取散标列表, 返回列表 """
domain = PaipaiDai.get_domain(url)
result = []
data, cache = Server.get(url, cache=False)
if data:
data, next_page = Analyzer.get_loan_list(data)
print url
result.extend(data)
if next_page and total_page > 1:
next_page = os.path.join(domain, next_page.lstrip('/'))
time.sleep(3)
result.extend(PaipaiDai.get_loan_list(next_page, total_page-1))
return result
示例5: __open_well_loan
# 需要导入模块: from Server import Server [as 别名]
# 或者: from Server.Server import get [as 别名]
def __open_well_loan(url, page_count=1):
domain = PaipaiDai.get_domain(url)
data, cache = Server.get(url, cache=False, use_cookie=True)
if data:
loans, next_page = Analyzer.get_loan_list(data)
# 处理列表
for loan in loans:
if u'首次' not in loan['title'] and u'第1次' not in loan['title']:
# 过滤第一次的用户
PpOpen.analyze_loan(loan['detail_url'])
time.sleep(2)
if next_page and page_count > 0:
time.sleep(2)
next_page = os.path.join(domain, next_page.lstrip('/'))
PpOpen.open_well_loan(next_page, page_count=page_count-1)
示例6: __get_loan_huankuan_detail
# 需要导入模块: from Server import Server [as 别名]
# 或者: from Server.Server import get [as 别名]
def __get_loan_huankuan_detail(self):
my_loans = self.db.get_my_loan(0, 0)
for my_loan in my_loans:
url = 'http://invest.ppdai.com/account/paybacklendview/?ListingId={0}'.format(my_loan[4])
content, cache = Server.get(url, cache=True, use_cookie=True)
if content:
huankuans, huanqin = Analyzer.get_my_loan_huankuan_detail(content)
if len(huankuans) > 0:
dengerbenxi = map(lambda i: i[0], huankuans)
tiqians = map(lambda i: i[1], huankuans)
benjin = my_loan[3]
lilv = self.__getLilv(benjin, dengerbenxi, tiqians)
print '{0}: {1}'.format(my_loan[1], lilv)
if huanqin:
self.db.update_my_loan(my_loan[1], True, lilv)
else:
self.db.update_my_loan(my_loan[1], False, lilv)
if not cache:
time.sleep(2)
示例7: analyze_loan
# 需要导入模块: from Server import Server [as 别名]
# 或者: from Server.Server import get [as 别名]
def analyze_loan(url):
data, cache = Server.get(url, cache=False, use_cookie=True)
if data:
info = Analyzer.get_loan_detail(data)
if info and info['amount'] < 4000:
print url
# 判断借款成功次数>0
huanqing = info['tongji_info'].get('total_huanqing')
if huanqing and huanqing > 0:
# 已还完时间在2016/2之后
if info['lishi_borrowed'] \
and not info['has_buy'] \
and info['tiqian_days'] < -30 \
and len(info['tiqian_days_list']) > 2:
print u'买买买' + url
if len(info['tiqian_days_list']) > 3 and info['tiqian_days'] < -50:
res, msg = PaipaiDai.buy_loan(info['loan_id'], 50)
if not res:
print u'买买买失败:{0}'.format(msg)
else:
webbrowser.open_new_tab(url)
示例8: __check_attendance
# 需要导入模块: from Server import Server [as 别名]
# 或者: from Server.Server import get [as 别名]
def __check_attendance():
data, _ = Server.get('http://invest.ppdai.com/account/lend', cache=False, use_cookie=True)
if data:
return Analyzer.check_attendance(data)
return False
示例9: check_loan_qishu
# 需要导入模块: from Server import Server [as 别名]
# 或者: from Server.Server import get [as 别名]
def check_loan_qishu(url):
data, cache = Server.get(url, cache=False, use_cookie=True)
if data:
info = Analyzer.get_loan_detail(data)
if info:
qishu = info['qishu']