本文整理汇总了Python中bank.Bank.endDate方法的典型用法代码示例。如果您正苦于以下问题:Python Bank.endDate方法的具体用法?Python Bank.endDate怎么用?Python Bank.endDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bank.Bank
的用法示例。
在下文中一共展示了Bank.endDate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fetchBankList
# 需要导入模块: from bank import Bank [as 别名]
# 或者: from bank.Bank import endDate [as 别名]
def fetchBankList(self):
f = self.openUrl("http://cards.ecitic.com/youhui/shuakahuodong.shtml");
if f == None:
return;
soup = BeautifulSoup(f);
lis = soup.find_all("li", class_="emb4 item-n");
banks = [];
for li in lis:
b = Bank();
h2 = li.find_all("h2")[0];
title = h2.string.encode("utf-8");
b.title = re.sub(r"\[.*\]", "", title);
m = re.match(r".*\[(.*)\].*", title);
if m:
b.city = m.group(1);
b.name = self.getName();
b.url = "http://cards.ecitic.com/youhui/" +li.find("a", class_="a-h")["href"].encode("utf-8");
ds = li.find("span", class_="date")
if ds and ds.string:
ds = ds.string.encode("utf-8");
m = re.match(r".*-(.*)", ds)
if m:
b.endDate = date_parser.parseSlashStyle(m.group(1).strip());
banks.append(b);
return banks;
示例2: fetchBankList
# 需要导入模块: from bank import Bank [as 别名]
# 或者: from bank.Bank import endDate [as 别名]
def fetchBankList(self):
banks = [];
baseUrl = "http://creditcard.pingan.com/cms-tmplt/creditcard/searchPreferentialActivity.do?type=&city=shenzhen¤tPage=%d";
for page in range(1, self.getPageRange()):
url = baseUrl % page;
soup = self.getSoup(url);
if not soup:
break;
lis = soup.find_all("tr", class_="item");
if len(lis) == 0:
break;
for l in lis:
b = Bank();
a = l.find("a");
title = a["title"].encode("utf-8");
m = re.match(r"\[(.*)\]", title);
if m:
b.city = m.group(1);
b.title = re.sub(r"【.*】|\[.*\]", "", title);
b.url = "http://creditcard.pingan.com" + a["href"].encode("utf-8");
ds = l.contents[-2].string.encode("utf-8");
b.endDate = date_parser.parseDashLineStyle(ds);
banks.append(b);
return banks;
示例3: fetchBankList
# 需要导入模块: from bank import Bank [as 别名]
# 或者: from bank.Bank import endDate [as 别名]
def fetchBankList(self):
prefUrls = ["http://creditcard.hxb.com.cn/hotnews/index.jsp?cid=12347700871250001", "http://creditcard.hxb.com.cn/hotnews/index.jsp?cid=12347701281290003"];
banks = [];
for prefUrl in prefUrls:
for page in range(0, self.getPageRange()):
url = prefUrl + "&page_count=30&page_start=%d" % (page*5);
soup = self.getSoup(url);
if not self.isValidSoup(soup):
break;
lis = soup.find_all("div", id="rm_lcd");
for l in lis:
b = Bank();
a = l.find("a");
b.url = "http://creditcard.hxb.com.cn/hotnews/" + a["href"].encode("utf-8");
b.title = a["title"].encode("utf-8").strip();
h6 = l.find("h6").string;
if h6 != None:
m = re.match("\[.*至(.*)\]", h6.encode("utf-8"));
if m != None:
b.endDate = date_parser.parseDashLineStyle(m.group(1));
banks.append(b);
return banks;
示例4: fetchBankList
# 需要导入模块: from bank import Bank [as 别名]
# 或者: from bank.Bank import endDate [as 别名]
def fetchBankList(self):
banks = []
url = "http://creditcard.ccb.com/favorable/activelist_%d.html"
for p in range(1, FIXED_COUNT):
soup = self.getSoup(url % p)
if soup == None:
break
anchors = soup.find_all("a", onclick=re.compile("getHelpInfo"))
for anchor in anchors:
b = Bank()
b.title = anchor["title"].encode("utf-8")
b.url = "http://creditcard.ccb.com" + anchor["href"].encode("utf-8")
b.endDate = self.getDateByUrl(b.url)
banks.append(b)
return banks
示例5: fetchBankList
# 需要导入模块: from bank import Bank [as 别名]
# 或者: from bank.Bank import endDate [as 别名]
def fetchBankList(self):
banks = [];
for page in range(1, FIXED_COUNT):
url = "http://creditcard.bankcomm.com/bcms/front/activity/ajax/search.do?tab=1&pageNo=%d&isPage=true" % (page,);
soup = self.getSoup(url);
if not soup:
return banks
lis = soup.find_all("div", class_="wzms");
for l in lis:
b = Bank();
b.url = "http://creditcard.bankcomm.com" + l.next_sibling.next_sibling.find("a", class_="btnMore")["href"].encode("utf-8");
b.title = l.find("td", class_="t2").string.encode("utf-8").strip();
b.endDate = date_parser.parseZhiStyle(l.find("td", class_="t4").string.encode("utf-8").strip());
banks.append(b);
return banks;
示例6: fetchBankList
# 需要导入模块: from bank import Bank [as 别名]
# 或者: from bank.Bank import endDate [as 别名]
def fetchBankList(self):
banks = [];
baseUrls = ["http://card.cgbchina.com.cn/Channel/11820301?currentChannelPage=%d", "http://card.cgbchina.com.cn/Channel/11820220?currentChannelPage=%d", "http://card.cgbchina.com.cn/Channel/11820139?currentChannelPage=%d"];
for baseUrl in baseUrls:
for page in range(1, self.getPageRange()):
url = baseUrl % page;
soup = self.getSoup(url);
if not soup:
break;
youhuiContent = soup.find("div", class_="youhui_content");
if len(youhuiContent.contents) <= 1:
break;
for a in youhuiContent.find_all("a"):
bank = Bank();
title = a.string.encode("utf-8");
m = re.match(r"【(.*)】(.*)", title);
if not m:
bank.title = title;
else:
bank.city = m.group(1);
bank.title = m.group(2);
url = a["href"].encode("utf-8");
if url.find("http") != -1:
bank.url = url;
else:
bank.url = "http://card.cgbchina.com.cn" + url;
dateStr = a.parent.find_next_sibling("p").string
if dateStr:
dateStr = dateStr.encode("utf-8").split("-")[-1].strip();
try:
bank.endDate = datetime.strptime(dateStr, "%Y.%m.%d");
except ValueError:
pass;
banks.append(bank);
return banks;