Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.

Commit 751041a

Browse files
committed
Add python install instructions. Add file support as input
1 parent 7de008d commit 751041a

17 files changed

+23
-319
lines changed

doc/images/1.1.1.png

245 KB
Loading

doc/images/1.1.2.png

88.4 KB
Loading

doc/images/1.1.3.png

77.8 KB
Loading

doc/images/1.1.4.png

82.5 KB
Loading

firststreet/api/adaptation.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ def get_detail(self, fsids, csv=False, limit=100):
2121
returns a list of Adaptation Detail objects.
2222
2323
Args:
24-
fsids (list): A First Street ID
24+
fsids (list/file): A First Street Foundation IDs or a file of First Street Foundation IDs
2525
csv (bool): To output extracted data to a csv or not
2626
limit (int): max number of connections to make
2727
Returns:
2828
A list of Adaptation Detail
2929
"""
30-
3130
# Get data from api and create objects
3231
api_datas = self.call_api(fsids, "adaptation", "detail", None, limit=limit)
3332
product = [AdaptationDetail(api_data) for api_data in api_datas]
@@ -42,7 +41,7 @@ def get_summary(self, fsids, location_type, csv=False, limit=100):
4241
returns a list of Adaptation Summary objects.
4342
4443
Args:
45-
fsids (list): A First Street ID
44+
fsids (list/file): A First Street Foundation IDs or a file of First Street Foundation IDs
4645
location_type (str): The location lookup type
4746
csv (bool): To output extracted data to a csv or not
4847
limit (int): max number of connections to make

firststreet/api/api.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
import asyncio
66

77
# Internal Imports
8+
import os
9+
810
from firststreet.errors import InvalidArgument
11+
from firststreet.util import read_fsid_file
912

1013

1114
class Api:
@@ -25,14 +28,19 @@ def call_api(self, fsids, product, product_subtype, location, limit=100):
2528
Street Foundation API.
2629
2730
Args:
28-
fsids (list): A First Street ID
31+
fsids (list/file): A First Street Foundation IDs or a file of First Street Foundation IDs
2932
product (str): The overall product to call
3033
product_subtype (str): The product subtype (if suitable)
3134
location (str/None): The location lookup type (if suitable)
3235
limit (int): max number of connections to make
3336
Returns:
3437
A list of JSON responses
3538
"""
39+
if not isinstance(fsids, list):
40+
if os.path.isfile(fsids):
41+
fsids = read_fsid_file(fsids)
42+
else:
43+
raise InvalidArgument("File provided is not a list or a valid file. Please check the file name.")
3644

3745
if not fsids:
3846
raise InvalidArgument(fsids)

firststreet/api/environmental.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def get_precipitation(self, fsids, csv=False, limit=100):
1919
and returns a list of Environmental Precipitation objects.
2020
2121
Args:
22-
fsids (list): A First Street ID
22+
fsids (list/file): A First Street Foundation IDs or a file of First Street Foundation IDs
2323
csv (bool): To output extracted data to a csv or not
2424
limit (int): max number of connections to make
2525
Returns:

firststreet/api/fema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def get_nfip(self, fsids, location_type, csv=False, limit=100):
2020
returns a list of Fema Nfip objects.
2121
2222
Args:
23-
fsids (list): A First Street ID
23+
fsids (list/file): A First Street Foundation IDs or a file of First Street Foundation IDs
2424
location_type (str): The location lookup type
2525
csv (bool): To output extracted data to a csv or not
2626
limit (int): max number of connections to make

firststreet/api/historic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def get_event(self, fsids, csv=False, limit=100):
2121
returns a list of Historic Event objects.
2222
2323
Args:
24-
fsids (list): A First Street ID
24+
fsids (list/file): A First Street Foundation IDs or a file of First Street Foundation IDs
2525
csv (bool): To output extracted data to a csv or not
2626
limit (int): max number of connections to make
2727
Returns:
@@ -42,7 +42,7 @@ def get_summary(self, fsids, location_type, csv=False, limit=100):
4242
returns a list of Historic Summary objects.
4343
4444
Args:
45-
fsids (list): A First Street ID
45+
fsids (list/file): A First Street Foundation IDs or a file of First Street Foundation IDs
4646
location_type (str): The location lookup type
4747
csv (bool): To output extracted data to a csv or not
4848
limit (int): max number of connections to make

firststreet/api/location.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def get_detail(self, fsids, location_type, csv=False, limit=100):
2323
returns a list of Location Detail objects.
2424
2525
Args:
26-
fsids (list): A First Street ID
26+
fsids (list/file): A First Street Foundation IDs or a file of First Street Foundation IDs
2727
location_type (str): The location lookup type
2828
csv (bool): To output extracted data to a csv or not
2929
limit (int): max number of connections to make
@@ -79,7 +79,7 @@ def get_summary(self, fsids, location_type, csv=False, limit=100):
7979
returns a list of Location Summary objects.
8080
8181
Args:
82-
fsids (list): A First Street ID
82+
fsids (list/file): A First Street Foundation IDs or a file of First Street Foundation IDs
8383
location_type (str): The location lookup type
8484
csv (bool): To output extracted data to a csv or not
8585
limit (int): max number of connections to make

0 commit comments

Comments
 (0)