forked from dominicgs/pyFCC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_grantees.py
More file actions
executable file
·26 lines (22 loc) · 920 Bytes
/
Copy pathupdate_grantees.py
File metadata and controls
executable file
·26 lines (22 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python3
from pyFCC.grantees import fetch_grantees_xml, parse_grantees#, write_db
from pyFCC.fccDB import create_grantee_table, populate_grantees
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-r", "--remote", help="Download grantee data from FCC website", action="store_true")
parser.add_argument("-l", "--local", help="Create grantee database from local file", action="store_true")
args = parser.parse_args()
if args.remote:
print("Downloading grantee data...")
fetch_grantees_xml()
try:
grantees = parse_grantees()
except FileNotFoundError:
print("No local xml file found")
print("Use '--help' for help")
print("Downloading grantee data...")
fetch_grantees_xml()
grantees = parse_grantees()
create_grantee_table()
populate_grantees(grantees)