Skip to content

Commit d7995c6

Browse files
committed
Update example get_historical_flat_files to work with EDGE
1 parent 51b4d00 commit d7995c6

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

ravenpackapi/examples/get_historical_flat_files.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,28 @@
77
from ravenpackapi import RPApi
88
from ravenpackapi.util import parse_csv_line
99

10+
PRODUCT = "rpa" # Or PRODUCT="edge"
11+
12+
if PRODUCT == "rpa":
13+
# Flat type for RPA:
14+
FLAT_TYPE = "companies" # One of "companies", "full"
15+
# FLAT_TYPE = "full"
16+
else:
17+
# Flat type for EDGE:
18+
FLAT_TYPE = "ESS_POSITIVE" # One of the many edge flatfiles
19+
1020

1121
def main():
12-
api_key = os.environ["RP_API_KEY"] # set your API KEY here
13-
api = RPApi(api_key)
22+
api = RPApi(product=PRODUCT)
1423

15-
flat_type = "companies" # can be 'companies' or 'full'
16-
flat_list = api.get_flatfile_list(flat_type)
24+
flat_list = api.get_flatfile_list(FLAT_TYPE)
1725

1826
for flat_file in flat_list:
1927
file_id = flat_file["id"]
2028
combined_year_filename = "%s.combined.csv" % file_id
2129
if os.path.isfile(combined_year_filename):
2230
continue
23-
download_flatfile(api, flat_type, flat_file)
31+
download_flatfile(api, FLAT_TYPE, flat_file)
2432
unzip_to_csv(file_id, combined_year_filename)
2533

2634

0 commit comments

Comments
 (0)