def get_pacer_case_id(self):
        # It's tempting to get this value from the URL in the first cell, but
        # that URL can sometimes differ from the URL used in the goDLS function.
        # When that's the case, the download fails.
        try:
            onclick = self.element.xpath('./td[3]//@onclick')[0]
        except IndexError:
            pass
        else:
            if 'goDLS' in onclick:
                # Sometimes the onclick is something else, like in insb's free
                # opinion report.
                return reverse_goDLS_function(onclick)['caseid']

        # No onclick, onclick isn't a goDLS link, etc. Try second format.
        if self._sort_order == 'case_number':
            try:
                # This tends to work in the bankr. courts.
                href = self.element.xpath('./td[1]//@href')[0]
            except IndexError:
                logger.info("No content provided in first cell of row. Using "
                            "last good row for pacer_case_id, docket_number, "
                            "and case_name.")
                return self.last_good_row.pacer_case_id
        elif self._sort_order == 'date_filed':
            href = self.element.xpath('./td[2]//@href')[0]
        return get_pacer_case_id_from_docket_url(href)
Beispiel #2
0
 def test_reverse_dls_function(self):
     """Can we parse the javascript correctly to get a good dict?"""
     qa_pairs = (
         ("goDLS('/doc1/01712427473','56121','69','','','1','','');return(false);",
          {'form_post_url': '/doc1/01712427473', 'caseid': '56121',
           'de_seq_num': '69', 'got_receipt': '', 'pdf_header': '',
           'pdf_toggle_possible': '1', 'magic_num': '', 'hdr': ''}),
     )
     for q, a in qa_pairs:
         self.assertEqual(reverse_goDLS_function(q), a)
Beispiel #3
0
 def test_reverse_dls_function(self):
     """Can we parse the javascript correctly to get a good dict?"""
     qa_pairs = (
         ("goDLS('/doc1/01712427473','56121','69','','','1','','');return(false);",
          {'form_post_url': '/doc1/01712427473', 'caseid': '56121',
           'de_seq_num': '69', 'got_receipt': '', 'pdf_header': '',
           'pdf_toggle_possible': '1', 'magic_num': '', 'hdr': ''}),
     )
     for q, a in qa_pairs:
         self.assertEqual(reverse_goDLS_function(q), a)
 def test_reverse_dls_function(self):
     """Can we parse the javascript correctly to get a good dict?"""
     qa_pairs = ((
         "goDLS('/doc1/01712427473','56121','69','','','1','','');return(false);",
         {
             "form_post_url": "/doc1/01712427473",
             "caseid": "56121",
             "de_seq_num": "69",
             "got_receipt": "",
             "pdf_header": "",
             "pdf_toggle_possible": "1",
             "magic_num": "",
             "hdr": "",
         },
     ), )
     for q, a in qa_pairs:
         self.assertEqual(reverse_goDLS_function(q), a)