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


Python Bank.endDate方法代碼示例

本文整理匯總了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;
開發者ID:ufo22940268,項目名稱:PromotionScrachServer,代碼行數:28,代碼來源:ecitic.py

示例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&currentPage=%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;
開發者ID:ufo22940268,項目名稱:PromotionScrachServer,代碼行數:29,代碼來源:pingan.py

示例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;
開發者ID:ufo22940268,項目名稱:PromotionScrachServer,代碼行數:27,代碼來源:hxb.py

示例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
開發者ID:ufo22940268,項目名稱:PromotionScrachServer,代碼行數:20,代碼來源:ccb.py

示例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;
開發者ID:ufo22940268,項目名稱:PromotionScrachServer,代碼行數:20,代碼來源:comm.py

示例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;
開發者ID:ufo22940268,項目名稱:PromotionScrachServer,代碼行數:44,代碼來源:cgb.py


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