from django.core.management.base import BaseCommand, CommandError from outside_spending.models import unprocessed_filing, processing_memo, Committee_Overlay, Filing_Scrape_Time from outside_spending.read_FEC_settings import FILECACHE_DIRECTORY, USER_AGENT, FEC_DOWNLOAD, DELAY_TIME, MAX_FILING_KEY from outside_spending.utils.fec_logging import fec_logger # parser regexes -- it's cleaner to use regexes than html parsing download_area_re = re.compile("<DL>(.+)<BR><P ALIGN=CENTER>", re.S) committee_name_re = "<H4><A HREF='\/cgi-bin\/dcdev\/forms/(C\d+)\/'>(.*?)\s+-\s+C\d+\s*<\/A><\/H4>" line_re = " (.+?)\n" form_re = "<A HREF='\/cgi-bin\/dcdev\/forms\/(C\d+)\/(\d+)\/'>View<\/A> <A HREF='\/cgi-bin\/dcdev\/forms/DL\/\d+\/'>Download</A> \s+FEC-\d+\s+Form\s+(F.*?)\s+" period_re = "-\s*period (\d\d\/\d\d\/\d\d\d\d)-(\d\d\/\d\d\/\d\d\d\d)," filed_re = "filed\s+(\d\d\/\d\d\/\d\d\d\d)\s+" my_logger = fec_logger() def enter_filing(data_hash): print "\tentering %s" % (data_hash['filing_number']) is_superpac = False filing_created = False try: Committee_Overlay.objects.get(fec_id=data_hash['committee_id'], is_superpac=True) is_superpac = True except Committee_Overlay.DoesNotExist: pass try: unprocessed_filing.objects.get(
def __init__(self): self.fp = form_parser() self.FEClogger=fec_logger()