Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from GravesJake/master
Store product data in DB
- Loading branch information
Showing
5 changed files
with
86 additions
and
109 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from pyFCC.archive import get_attachment_urls, parse_fcc_id, load_next, fetch_and_pack#, errorFunction | ||
from pyFCC.fccDB import create_product_table, populate_products | ||
import sys | ||
|
||
if __name__ == '__main__': | ||
if len(sys.argv) <2: | ||
print("Usage: archive.py <FCC id>") | ||
sys.exit(1) | ||
for fcc_id in sys.argv[1:]: | ||
print("Looking up FCC id: %s" % fcc_id) | ||
product_data = load_next(fcc_id) | ||
|
||
for key, value in product_data.items(): | ||
for row in value: | ||
print("Fetching result %d" % row['version']) | ||
attachments = get_attachment_urls(row['url']) | ||
|
||
if attachments: | ||
dir_name = "%s/%s/%d" % (row['grantee_code'], row['product_code'], row['version']) | ||
fetch_and_pack(attachments, dir_name, row['url']) | ||
|
||
create_product_table() | ||
populate_products(product_data) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters