def test_get_pacer_document_number_from_doc1_url(self): qa_pairs = ( ('https://ecf.almd.uscourts.gov/doc1/01712427473', '01712427473'), ('/doc1/01712427473', '01712427473'), ) for q, a in qa_pairs: self.assertEqual(get_pacer_doc_id_from_doc1_url(q), a)
def test_get_pacer_document_number_from_doc1_url(self): qa_pairs = ( ('https://ecf.almd.uscourts.gov/doc1/01712427473', '01702427473'), ('/doc1/01712427473', '01702427473'), ('https://ecf.akb.uscourts.gov/doc1/02201247000?caseid=7738&de_seq_num=723284&dm_id=1204742&doc_num=8805&pdf_header=0', '02201247000'), ) for q, a in qa_pairs: self.assertEqual(get_pacer_doc_id_from_doc1_url(q), a)
def test_get_pacer_document_number_from_doc1_url(self): qa_pairs = ( ('https://ecf.almd.uscourts.gov/doc1/01712427473', '01702427473'), ('/doc1/01712427473', '01702427473'), ('https://ecf.akb.uscourts.gov/doc1/02201247000?caseid=7738&de_seq_num=723284&dm_id=1204742&doc_num=8805&pdf_header=0', '02201247000'), ) for q, a in qa_pairs: self.assertEqual(get_pacer_doc_id_from_doc1_url(q), a)
def _get_pacer_doc_id(row): """Take in a row from the attachment table and return the pacer_doc_id for the item in that row. Return None if the ID cannot be found. """ try: url = row.xpath(u'.//a')[0] except IndexError: # Item exists, but cannot download document. Perhaps it's sealed # or otherwise unavailable in PACER. This is carried over from the # docket report and may not be needed here, but it's a good # precaution. return None else: doc1_url = url.xpath('./@href')[0] return get_pacer_doc_id_from_doc1_url(doc1_url)
def _get_pacer_doc_id(row): """Take in a row from the attachment table and return the pacer_doc_id for the item in that row. Return None if the ID cannot be found. """ try: url = row.xpath(u'.//a')[0] except IndexError: # Item exists, but cannot download document. Perhaps it's sealed # or otherwise unavailable in PACER. This is carried over from the # docket report and may not be needed here, but it's a good # precaution. return None else: doc1_url = url.xpath('./@href')[0] return get_pacer_doc_id_from_doc1_url(doc1_url)
def get_pacer_doc_id(self): doc1_url = self.element.xpath('./td[3]//@href')[0] return get_pacer_doc_id_from_doc1_url(doc1_url)