@@ -20,54 +20,57 @@ class Probability(Api):
2020 get_cumulative: Retrieves a list of Probability Depth for the given list of IDs
2121 """
2222
23- def get_depth (self , fsids , csv = False ):
23+ def get_depth (self , fsids , csv = False , limit = 100 ):
2424 """Retrieves probability depth product data from the First Street Foundation API given a list of FSIDs and
2525 returns a list of Probability Depth objects.
2626
2727 Args:
2828 fsids (list): A First Street ID
2929 csv (bool): To output extracted data to a csv or not
30+ limit (int): max number of connections to make
3031 Returns:
3132 A list of Probability Depth
3233 """
3334
3435 # Get data from api and create objects
35- api_datas = self .call_api (fsids , "probability" , "depth" , "property" )
36+ api_datas = self .call_api (fsids , "probability" , "depth" , "property" , limit = limit )
3637 product = [ProbabilityDepth (api_data ) for api_data in api_datas ]
3738
3839 if csv :
3940 csv_format .to_csv (product , "probability" , "depth" )
4041
4142 return product
4243
43- def get_chance (self , fsids , csv = False ):
44+ def get_chance (self , fsids , csv = False , limit = 100 ):
4445 """Retrieves probability chance product data from the First Street Foundation API given a list of FSIDs and
4546 returns a list of Probability Chance objects.
4647
4748 Args:
4849 fsids (list): A First Street ID
4950 csv (bool): To output extracted data to a csv or not
51+ limit (int): max number of connections to make
5052 Returns:
5153 A list of Probability Chance
5254 """
5355
5456 # Get data from api and create objects
55- api_datas = self .call_api (fsids , "probability" , "chance" , "property" )
57+ api_datas = self .call_api (fsids , "probability" , "chance" , "property" , limit = limit )
5658 product = [ProbabilityChance (api_data ) for api_data in api_datas ]
5759
5860 if csv :
5961 csv_format .to_csv (product , "probability" , "chance" )
6062
6163 return product
6264
63- def get_count (self , fsids , location_type , csv = False ):
65+ def get_count (self , fsids , location_type , csv = False , limit = 100 ):
6466 """Retrieves probability count product data from the First Street Foundation API given a list of FSIDs and
6567 returns a list of Probability Count objects.
6668
6769 Args:
6870 fsids (list): A First Street ID
6971 location_type (str): The location lookup type
7072 csv (bool): To output extracted data to a csv or not
73+ limit (int): max number of connections to make
7174 Returns:
7275 A list of Probability Count
7376 Raises:
@@ -81,47 +84,49 @@ def get_count(self, fsids, location_type, csv=False):
8184 raise TypeError ("location is not a string" )
8285
8386 # Get data from api and create objects
84- api_datas = self .call_api (fsids , "probability" , "count" , location_type )
87+ api_datas = self .call_api (fsids , "probability" , "count" , location_type , limit = limit )
8588 product = [ProbabilityCount (api_data ) for api_data in api_datas ]
8689
8790 if csv :
8891 csv_format .to_csv (product , "probability" , "count" , location_type )
8992
9093 return product
9194
92- def get_count_summary (self , fsids , csv = False ):
95+ def get_count_summary (self , fsids , csv = False , limit = 100 ):
9396 """Retrieves probability Count-Summary product data from the First Street Foundation API given a list of FSIDs
9497 and returns a list of Probability Count-Summary object.
9598
9699 Args:
97100 fsids (list): A First Street ID
98101 csv (bool): To output extracted data to a csv or not
102+ limit (int): max number of connections to make
99103 Returns:
100104 A list of Probability Count-Summary
101105 """
102106
103107 # Get data from api and create objects
104- api_datas = self .call_api (fsids , "probability" , "count-summary" , "property" )
108+ api_datas = self .call_api (fsids , "probability" , "count-summary" , "property" , limit )
105109 product = [ProbabilityCountSummary (api_data ) for api_data in api_datas ]
106110
107111 if csv :
108112 csv_format .to_csv (product , "probability" , "count-summary" )
109113
110114 return product
111115
112- def get_cumulative (self , fsids , csv = False ):
116+ def get_cumulative (self , fsids , csv = False , limit = 100 ):
113117 """Retrieves probability cumulative product data from the First Street Foundation API given a list of FSIDs and
114118 returns a list of Probability Cumulative object.
115119
116120 Args:
117121 fsids (list): A First Street ID
118122 csv (bool): To output extracted data to a csv or not
123+ limit (int): max number of connections to make
119124 Returns:
120125 A list of Probability Cumulative
121126 """
122127
123128 # Get data from api and create objects
124- api_datas = self .call_api (fsids , "probability" , "cumulative" , "property" )
129+ api_datas = self .call_api (fsids , "probability" , "cumulative" , "property" , limit = limit )
125130 product = [ProbabilityCumulative (api_data ) for api_data in api_datas ]
126131
127132 if csv :
0 commit comments