Ejemplo n.º 1
0
def create_docket_pickles(path, court):
    #check if docket pickle directory exists and pickle generation has completed
    opinion_reports= glob.glob(os.path.join(path, "*.opinions.*"))


    try:
        os.mkdir(os.path.join(path, 'docket_pickles'))
    except OSError:
        #delete docket_pickles
        pass

    for report in opinion_reports:
        filebits = open(report).read()
        dockets = PP.parse_opinions(filebits, court)

        if dockets:
            print "Found %s dockets in %s " % (len(dockets), report)
            for docket in dockets:
                if len(docket.documents) != 1:
                    raise "This docket has more than one document! docket text: " % docket
                doc = docket.documents.values()[0]
                filename = _get_docket_pickle_filename(court, doc['casenum'], doc['doc_num'], doc['attachment_num'])
                success, msg = IA.pickle_object(docket, filename, os.path.join(path, "docket_pickles"))

                if not success:
                    print "Error pickling file %s: %s " % (filename, msg)
Ejemplo n.º 2
0
    def get_opinions(self, court, start_date, end_date):
        html = self.pacer_client.get_opinions_html(court, start_date, end_date)

        dockets = PP.parse_opinions(html, court)
        logger.info(' Downloaded %d dockets for court %s between %s and %s',
                    len(dockets), court, start_date, end_date)
        #if len(dockets) == 0:
        #    logger.debug(' 0 dockets downloaded. HTML response: %s', html)
        return dockets
    def get_opinions(self, court, start_date, end_date):
        html = self.pacer_client.get_opinions_html(court,
                                                   start_date,
                                                   end_date)

        dockets = PP.parse_opinions(html, court)
        logger.info(' Downloaded %d dockets for court %s between %s and %s', len(dockets), 
                                                                       court,
                                                                       start_date,
                                                                       end_date)
        #if len(dockets) == 0:
        #    logger.debug(' 0 dockets downloaded. HTML response: %s', html)
        return dockets