@@ -19,14 +19,15 @@ class Adaptation(Api):
1919 get_summary: Retrieves a list of Adaptation Summary for the given list of IDs
2020 """
2121
22- def get_detail (self , fsids , csv = False , limit = 100 ):
22+ def get_detail (self , fsids , csv = False , limit = 100 , output_dir = None ):
2323 """Retrieves adaptation detail product data from the First Street Foundation API given a list of FSIDs and
2424 returns a list of Adaptation Detail objects.
2525
2626 Args:
2727 fsids (list/file): A First Street Foundation IDs or a file of First Street Foundation IDs
2828 csv (bool): To output extracted data to a csv or not
2929 limit (int): max number of connections to make
30+ output_dir (str): The output directory to save the generated csvs
3031 Returns:
3132 A list of Adaptation Detail
3233 """
@@ -35,13 +36,13 @@ def get_detail(self, fsids, csv=False, limit=100):
3536 product = [AdaptationDetail (api_data ) for api_data in api_datas ]
3637
3738 if csv :
38- csv_format .to_csv (product , "adaptation" , "detail" )
39+ csv_format .to_csv (product , "adaptation" , "detail" , output_dir = output_dir )
3940
4041 logging .info ("Adaptation Detail Data Ready." )
4142
4243 return product
4344
44- def get_summary (self , fsids , location_type , csv = False , limit = 100 ):
45+ def get_summary (self , fsids , location_type , csv = False , limit = 100 , output_dir = None ):
4546 """Retrieves adaptation summary product data from the First Street Foundation API given a list of FSIDs and
4647 returns a list of Adaptation Summary objects.
4748
@@ -50,6 +51,7 @@ def get_summary(self, fsids, location_type, csv=False, limit=100):
5051 location_type (str): The location lookup type
5152 csv (bool): To output extracted data to a csv or not
5253 limit (int): max number of connections to make
54+ output_dir (str): The output directory to save the generated csvs
5355 Returns:
5456 A list of Adaptation Summary
5557 """
@@ -64,7 +66,7 @@ def get_summary(self, fsids, location_type, csv=False, limit=100):
6466 product = [AdaptationSummary (api_data ) for api_data in api_datas ]
6567
6668 if csv :
67- csv_format .to_csv (product , "adaptation" , "summary" , location_type )
69+ csv_format .to_csv (product , "adaptation" , "summary" , location_type , output_dir = output_dir )
6870
6971 logging .info ("Adaptation Summary Data Ready." )
7072
0 commit comments