mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-14 00:27:06 +02:00
Setup initial CI gating on tests and add linting tests (#85)
* add flake, black, mypy, and bandit to run * fixes issues flake and black complained about * make mypy run successfully, add configuration files rather than specifying in ci * respond to feedback * configure bandit, ignore a file used only in local development
This commit is contained in:
parent
e288578028
commit
8f41050f76
12 changed files with 124 additions and 71 deletions
|
@ -10,12 +10,15 @@ This script can be run locally to generate data and currently takes some time to
|
|||
import csv
|
||||
import requests
|
||||
|
||||
DOMAIN_LIST_URL = "https://raw.githubusercontent.com/cisagov/dotgov-data/main/current-full.csv"
|
||||
DOMAIN_LIST_URL = (
|
||||
"https://raw.githubusercontent.com/cisagov/dotgov-data/main/current-full.csv"
|
||||
)
|
||||
|
||||
data = requests.get(DOMAIN_LIST_URL).content.decode("utf-8")
|
||||
csv_data = list(csv.reader(data.splitlines(), delimiter=","))
|
||||
domains = csv_data[1:]
|
||||
fields = csv_data[0] + ["Response"]
|
||||
|
||||
data = requests.get(DOMAIN_LIST_URL).content.decode('utf-8')
|
||||
csv_data = list(csv.reader(data.splitlines(), delimiter=','))
|
||||
domains = csv_data[1:]
|
||||
fields = csv_data[0] + ['Response']
|
||||
|
||||
def check_status_response(domain):
|
||||
try:
|
||||
|
@ -24,13 +27,14 @@ def check_status_response(domain):
|
|||
response = type(e).__name__
|
||||
return response
|
||||
|
||||
|
||||
full_data = []
|
||||
for domain in domains:
|
||||
domain_name = domain[0]
|
||||
response = check_status_response(domain_name)
|
||||
full_data.append(domain + [response])
|
||||
|
||||
with open('../data/response_codes.csv', 'w') as f:
|
||||
with open("../data/response_codes.csv", "w") as f:
|
||||
writer = csv.writer(f)
|
||||
writer.writerow(fields)
|
||||
writer.writerows(full_data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue