def test_get_protests_from_listing(self): gao = GAO(start_date='2015-01-01', end_date='2015-01-15') res_json = [] for res in gao.get_docket_list(): res_json.append(gao.get_protests_from_listing(res.text)) results = [protest for dockets in res_json for protest in dockets] assert results[8]["opinion"].summary is not None assert len(results) == 73
def test_get_docket_list_multiple(self): gao = GAO(start_date='2015-01-01', end_date='2015-01-15') res = gao.get_docket_list() for res in gao.get_docket_list(): assert res.status_code == 200 assert "Science Applications International Corporation" or "Man-Machine Systems Assessment Inc" in res.text
def test_get_docket_list(self): gao = GAO(start_date='2015-01-01', end_date='2015-01-08') for res in gao.get_docket_list(): assert res.status_code == 200 assert "National Veterans Service Bureau" in res.text
agency TEXT, solicitation_number TEXT, outcome TEXT, docket_url TEXT, filed_date TEXT, due_date TEXT, date_decided TEXT, case_type TEXT, gao_attorney TEXT, summary TEXT, decision TEXT ) ''') # Initialize the GAO scraper gao = GAO(start_date="2015-01-01", end_date="2016-01-05") # Paginate through the docket lists for res in gao.get_docket_list(): # Get the paginated docket list res_json = gao.get_protests_from_listing(res.text) # Take the protests and dump them into the database for protest in res_json: cursor.execute( '''INSERT INTO protests (name, agency, solicitation_number, outcome, docket_url, filed_date, due_date, date_decided, case_type, gao_attorney, summary, decision) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)''', (protest["name"], protest["agency"], protest.get("solicitation_number", ""), protest["outcome"], protest["docket_url"], protest["filed_date"], protest["due_date"],
def test_initalization(self): gao = GAO('2015-01-01', '2015-01-08') assert gao.start_date == '2015-01-01' assert gao.end_date == '2015-01-08'
agency TEXT, solicitation_number TEXT, outcome TEXT, docket_url TEXT, filed_date TEXT, due_date TEXT, date_decided TEXT, case_type TEXT, gao_attorney TEXT, summary TEXT, decision TEXT ) ''') # Initialize the GAO scraper gao = GAO(start_date="2015-01-01", end_date="2016-01-05") # Paginate through the docket lists for res in gao.get_docket_list(): # Get the paginated docket list res_json = gao.get_protests_from_listing(res.text) # Take the protests and dump them into the database for protest in res_json: cursor.execute('''INSERT INTO protests (name, agency, solicitation_number, outcome, docket_url, filed_date, due_date, date_decided, case_type, gao_attorney, summary, decision) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)''', (protest["name"], protest["agency"], protest.get("solicitation_number", ""), protest["outcome"], protest["docket_url"], protest["filed_date"], protest["due_date"], protest["date_decided"], protest["case_type"], protest["gao_attorney"], protest.get("opinion").summary if protest.get("opinion") else "", protest.get("opinion").decision if protest.get("opinion") else "")) db.commit() # Close the database db.close()