def natwest_main(static, forcedelete, logger): # TODO: Are there more categories to consider? See end # TODO: BTL - lots of categories here categorytypes = ["Fixed", "Variable"] mortgage_types = ["F", "T"] mortgage_types_tuples = zip(categorytypes, mortgage_types) customertypes = ["ftb", "remo", "pur", "ecmh", "ecss", "fa"] eligibilities = ["NFTB", "NRM", "NMH", "EMH", "EMH", "EBM"] types_tuples = zip(customertypes, eligibilities) for mortgage_types_tuple in mortgage_types_tuples: categorytype = mortgage_types_tuple[0] mortgage_type = mortgage_types_tuple[1] for types_tuple in types_tuples: customertype = types_tuple[0] eligibility = types_tuple[1] process_page( static, "http://www.natwest.com/webservices.ashx?service=2&responseformat=json&mortgageterm=25&mortgagetype=" + categorytype + "&customertype=" + customertype, mortgage_type, eligibility, ) mc_db.update_current(institution_code, main.today, forcedelete, logger)
def halifax_main(static, forcedelete, logger): halifax_ftb_page( static, 'http://www.halifax.co.uk/mortgages/first-time-buyers/fixed/?tag=But_fix_FTBHP', 'F', 'NFTB', logger) halifax_remortgage_page( static, 'http://www.halifax.co.uk/mortgages/remortgage-fixed-75ltv.asp', 'F', 'NRM', logger) halifax_remortgage_page( static, 'http://www.halifax.co.uk/mortgages/remortgage-fixed-60-75LTV.asp', 'F', 'NRM', logger) halifax_remortgage_page( static, 'http://www.halifax.co.uk/mortgages/remortgage-tracker-75ltv.asp', 'T', 'NRM', logger) halifax_remortgage_page( static, 'http://www.halifax.co.uk/mortgages/remortgage-tracker-60-75LTV.asp', 'T', 'NRM', logger) halifax_remortgage_page( static, 'http://www.halifax.co.uk/mortgages/existing-customers/switch-to-a-new-deal/', 'F', 'EED', logger) # TODO - BTL mc_db.update_current(institution_code, main.today, forcedelete, logger)
def post_office_main(static,forcedelete,logger): # full range used to build - no oligibility #get_product_page(static,'http://www.postoffice.co.uk/our-full-range') get_product_page(static,'http://www.postoffice.co.uk/existing-customers',['EED','EDE','EMH']) get_product_page(static,'http://www.postoffice.co.uk/remortgaging',['ERM','NRM','NMH']) get_product_page(static,'http://www.postoffice.co.uk/first-time-buyer',['NFTB']) mc_db.update_current(institution_code,main.today,forcedelete,logger)
def chelsea_main(static,forcedelete,logger): # http://www.thechelsea.co.uk/js/mortgage-data-ref.js # get the xml file from there, then parse it, eg # http://www.thechelsea.co.uk/mortgages/mortage-product-data-0031.xml url = themortgagemeter_utils.get_page(False,'','http://www.thechelsea.co.uk/js/mortgage-data-ref.js',logger,True).split('"')[1] xml_url = url get_product_pages(static,'http://www.thechelsea.co.uk/' + xml_url,logger) mc_db.update_current(institution_code,main.today,forcedelete,logger)
def halifax_main(static,forcedelete,logger): halifax_ftb_page(static,'http://www.halifax.co.uk/mortgages/first-time-buyers/fixed/?tag=But_fix_FTBHP','F','NFTB',logger) halifax_remortgage_page(static,'http://www.halifax.co.uk/mortgages/remortgage-fixed-75ltv.asp','F','NRM',logger) halifax_remortgage_page(static,'http://www.halifax.co.uk/mortgages/remortgage-fixed-60-75LTV.asp','F','NRM',logger) halifax_remortgage_page(static,'http://www.halifax.co.uk/mortgages/remortgage-tracker-75ltv.asp','T','NRM',logger) halifax_remortgage_page(static,'http://www.halifax.co.uk/mortgages/remortgage-tracker-60-75LTV.asp','T','NRM',logger) halifax_remortgage_page(static,'http://www.halifax.co.uk/mortgages/existing-customers/switch-to-a-new-deal/','F','EED',logger) # TODO - BTL mc_db.update_current(institution_code,main.today,forcedelete,logger)
def post_office_main(static, forcedelete, logger): # full range used to build - no oligibility #get_product_page(static,'http://www.postoffice.co.uk/our-full-range') get_product_page(static, 'http://www.postoffice.co.uk/existing-customers', ['EED', 'EDE', 'EMH']) get_product_page(static, 'http://www.postoffice.co.uk/remortgaging', ['ERM', 'NRM', 'NMH']) get_product_page(static, 'http://www.postoffice.co.uk/first-time-buyer', ['NFTB']) mc_db.update_current(institution_code, main.today, forcedelete, logger)
def northernrock_main(static,forcedelete,logger): # From: http://www.northernrock.co.uk/mortgages/ # Assumed these are new customers, since there's an extra section on "existing customers" # http://www.northernrock.co.uk/Mortgages/Find/Find-A-Mortgage/First-Time-Buyer process_page(static,'http://www.northernrock.co.uk','/Mortgages/Find/Find-A-Mortgage/First-Time-Buyer','NFTB') # http://www.northernrock.co.uk/Mortgages/Find/Find-A-Mortgage/Moving-Home process_page(static,'http://www.northernrock.co.uk/','Mortgages/Find/Find-A-Mortgage/Moving-Home','NMH') # http://www.northernrock.co.uk/Mortgages/Find/Find-A-Mortgage/Remortgage process_page(static,'http://www.northernrock.co.uk/','Mortgages/Find/Find-A-Mortgage/Remortgage','NRM') # TODO - BTL # http://www.northernrock.co.uk/Mortgages/Find/Find-A-Mortgage/Buy-To-Let mc_db.update_current(institution_code,main.today,forcedelete,logger)
def northernrock_main(static, forcedelete, logger): # From: http://www.northernrock.co.uk/mortgages/ # Assumed these are new customers, since there's an extra section on "existing customers" # http://www.northernrock.co.uk/Mortgages/Find/Find-A-Mortgage/First-Time-Buyer process_page(static, 'http://www.northernrock.co.uk', '/Mortgages/Find/Find-A-Mortgage/First-Time-Buyer', 'NFTB') # http://www.northernrock.co.uk/Mortgages/Find/Find-A-Mortgage/Moving-Home process_page(static, 'http://www.northernrock.co.uk/', 'Mortgages/Find/Find-A-Mortgage/Moving-Home', 'NMH') # http://www.northernrock.co.uk/Mortgages/Find/Find-A-Mortgage/Remortgage process_page(static, 'http://www.northernrock.co.uk/', 'Mortgages/Find/Find-A-Mortgage/Remortgage', 'NRM') # TODO - BTL # http://www.northernrock.co.uk/Mortgages/Find/Find-A-Mortgage/Buy-To-Let mc_db.update_current(institution_code, main.today, forcedelete, logger)
def skipton_main(static,forcedelete,logger): # BUY TO LET - TODO #http://www.skipton.co.uk/mortgages/buy-to-let_mortgages/ #http://www.skipton.co.uk/mortgages/first-time-buyer - none yet seen assuming tracker - to do! #href_re = re.compile(r'.*/mortgages/first-time-buyer.*aspx') href_re = ftb_re get_product_pages(static,'http://www.skipton.co.uk','/mortgages/first-time-buyer','T',href_re) #href_re = re.compile(r'.*/mortgages/Discount_mortgages.*aspx') href_re = discount_re get_product_pages(static,'http://www.skipton.co.uk','/mortgages/discount_mortgages','D',href_re) #href_re = re.compile(r'.*/mortgages/tracker_mortgages.*aspx') href_re = tracker_re get_product_pages(static,'http://www.skipton.co.uk','/mortgages/tracker_mortgages','T',href_re) #href_re = re.compile(r'.*/mortgages/fixed_rate_mortgages.*aspx') href_re = fr_re get_product_pages(static,'http://www.skipton.co.uk','/mortgages/fixed_rate_mortgages','F',href_re) mc_db.update_current(institution_code,main.today,forcedelete,logger)
def lloyds_main(static,forcedelete,logger): property_value = "300000" for buyer_type in ('first_time_buyer','remortgaging','switching_deals'): for mortgage_type_name in ('fixed','variable'): if mortgage_type_name == 'fixed': mortgage_type = 'F' elif mortgage_type_name == 'variable': mortgage_type = 'V' for ltv in ('60','70','75','80','90','95','100'): deposit_amount = str(((100 - int(ltv)) * int(property_value)) / 100) url = "http://www.lloydsbank.com/tools/paymentsCalculator.asp?buyerType=first_time_buyer&mortgageType=" + mortgage_type_name + "&repaymentType=Repayment+Only&initialTerm=all&propertyValue=" + property_value + "&depositAmount=" + deposit_amount + "&mortgageTerm=25<v=" + ltv + "&btnId=Find+Mortgages" if buyer_type == 'first_time_buyer': eligibilities = ['NFTB'] elif buyer_type == 'remortgaging': eligibilities = ['ERM','NRM','EMH'] elif buyer_type == 'switching_deals': eligibilities = ['EED'] get_product_pages(url,mortgage_type,ltv,eligibilities,logger) mc_db.update_current(institution_code,main.today,forcedelete,logger)
def natwest_main(static, forcedelete, logger): # TODO: Are there more categories to consider? See end # TODO: BTL - lots of categories here categorytypes = ['Fixed', 'Variable'] mortgage_types = ['F', 'T'] mortgage_types_tuples = zip(categorytypes, mortgage_types) customertypes = ['ftb', 'remo', 'pur', 'ecmh', 'ecss', 'fa'] eligibilities = ['NFTB', 'NRM', 'NMH', 'EMH', 'EMH', 'EBM'] types_tuples = zip(customertypes, eligibilities) for mortgage_types_tuple in mortgage_types_tuples: categorytype = mortgage_types_tuple[0] mortgage_type = mortgage_types_tuple[1] for types_tuple in types_tuples: customertype = types_tuple[0] eligibility = types_tuple[1] process_page( static, 'http://www.natwest.com/webservices.ashx?service=2&responseformat=json&mortgageterm=25&mortgagetype=' + categorytype + '&customertype=' + customertype, mortgage_type, eligibility) mc_db.update_current(institution_code, main.today, forcedelete, logger)
def lloyds_main(static, forcedelete, logger): property_value = "300000" for buyer_type in ('first_time_buyer', 'remortgaging', 'switching_deals'): for mortgage_type_name in ('fixed', 'variable'): if mortgage_type_name == 'fixed': mortgage_type = 'F' elif mortgage_type_name == 'variable': mortgage_type = 'V' for ltv in ('60', '70', '75', '80', '90', '95', '100'): deposit_amount = str( ((100 - int(ltv)) * int(property_value)) / 100) url = "http://www.lloydsbank.com/tools/paymentsCalculator.asp?buyerType=first_time_buyer&mortgageType=" + mortgage_type_name + "&repaymentType=Repayment+Only&initialTerm=all&propertyValue=" + property_value + "&depositAmount=" + deposit_amount + "&mortgageTerm=25<v=" + ltv + "&btnId=Find+Mortgages" if buyer_type == 'first_time_buyer': eligibilities = ['NFTB'] elif buyer_type == 'remortgaging': eligibilities = ['ERM', 'NRM', 'EMH'] elif buyer_type == 'switching_deals': eligibilities = ['EED'] get_product_pages(url, mortgage_type, ltv, eligibilities, logger) mc_db.update_current(institution_code, main.today, forcedelete, logger)
def nationwide_main(static,forcedelete,logger): #<option value="ftb">First time buyer</option> #<option value="nc-mh">New customer - moving home</option> #<option value="nc-r">New customer - remortgaging</option> #<option value="ec-mh">Existing customer - moving</option> #<option value="ec-bm">Existing customer - borrowing more</option> <-- doesn't seem to return mortgages when last tried #<option value="ec-de">Existing customer - deal ended</option> #<option value="ec-sf">Existing customer - switch and fix mid-deal</option> mortgage_amount = "150000" for buyer_type in ("ec-de","ec-bm","ftb", "nc-mh", "nc-r", "ec-mh", "ec-sf"): for ltv in ("60","70","75","80","85","90","95","100"): for product_type in ('fixed','tracker'): # NOW: #http://www.nationwide.co.uk/services/toolservice.svc/GetFullMortgageRates?buyerType=ftb&loanToValueTier=60&productType=all&mortgageTerm=25&mortgageAmount=100000&submit=true url = "http://www.nationwide.co.uk/services/toolservice.svc/GetFullMortgageRates?buyerType=" + buyer_type + "&loanToValueTier=" + ltv + "&productType=" + product_type + "&mortgageTerm=25&mortgageAmount=" + mortgage_amount if product_type == 'fixed': mortgage_type = 'F' elif product_type == 'tracker': mortgage_type = 'T' logger.debug("Doing: " + ltv + " " + mortgage_amount + " " + buyer_type + " " + product_type) if buyer_type == 'ftb': eligibility = "NFTB" elif buyer_type == 'nc-mh': eligibility = "NMH" elif buyer_type == 'nc-r': eligibility = "NRM" elif buyer_type == 'ec-mh': eligibility = "EMH" elif buyer_type == 'ec-bm': eligibility = "EBM" elif buyer_type == 'ec-de': eligibility = "EDE" elif buyer_type == 'ec-sf': eligibility = "EED" process_page(url,ltv,eligibility,mortgage_type,logger) mc_db.update_current(institution_code,main.today,forcedelete,logger)
def santander_main(static,forcedelete,logger): #get_product_pages(static,'http://www.santander-products.co.uk/mortgages/mortgage-calculator/js/productInfo.js') get_product_pages(static,'http://www.santander-products.co.uk/mortgages/mortgage-calculator/productInfo.php') mc_db.update_current(institution_code,main.today,forcedelete,logger)
def tesco_main(static,forcedelete,logger): get_product_pages(static,'http://www.tescobank.com/assets/sections/mortgages/selector/xml/Products.xml',logger) mc_db.update_current(institution_code,main.today,forcedelete,logger)
def nationwide_main(static, forcedelete, logger): # http://www.nationwide.co.uk/savings/default.htm mc_db.update_current(institution_code, main.today, forcedelete, logger)
def britannia_main(static,forcedelete,logger): base_url = 'http://www.britannia.co.uk/' get_product_pages(static,base_url,'_site/channels/mortgage/index.html',logger) mc_db.update_current(institution_code,main.today,forcedelete,logger)
def hsbc_main(static,forcedelete,logger): base_url = 'https://www.hsbc.co.uk/1/2' get_product_pages(static,base_url) mc_db.update_current(institution_code,main.today,forcedelete,logger)
def first_direct_main(static,forcedelete,logger): base_url = 'http://mortgages.firstdirect.com/mortgage-rates' get_product_page(static,base_url) mc_db.update_current(institution_code,main.today,forcedelete,logger)
def nationwide_main(static,forcedelete,logger): # http://www.nationwide.co.uk/savings/default.htm mc_db.update_current(institution_code,main.today,forcedelete,logger)
def tesco_main(static, forcedelete, logger): get_product_pages( static, 'http://www.tescobank.com/assets/sections/mortgages/selector/xml/Products.xml', logger) mc_db.update_current(institution_code, main.today, forcedelete, logger)
def hsbc_main(static, forcedelete, logger): base_url = 'https://www.hsbc.co.uk/1/2' get_product_pages(static, base_url) mc_db.update_current(institution_code, main.today, forcedelete, logger)
def yorkshire_main(static, forcedelete, logger): process_page('http://www.ybonline.co.uk/javascripts/personal-mortgages.js', logger) mc_db.update_current(institution_code, main.today, forcedelete, logger)
def britannia_main(static, forcedelete, logger): base_url = 'http://www.britannia.co.uk/' get_product_pages(static, base_url, '_site/channels/mortgage/index.html', logger) mc_db.update_current(institution_code, main.today, forcedelete, logger)