-
Notifications
You must be signed in to change notification settings - Fork 6
Running the Library Through the Command Line
[Reminder] Keep your API key safe, and do not share it with others!
[NOTE] This method will always generate a CSV.
[Required] Open a bash terminal
and set an Environmental Variable with the variable_name
as FSF_API_KEY
and the variable_value
with the API_KEY
with the command
export FSF_API_KEY=your personal API key
[Required] Set an Environmental Variable with the variable_name
as FSF_API_KEY
and the variable_value
with the API_KEY
.
2. Open/Re-open a powershell console
/ bash terminal
and navigate to the project directory. Next, call one of the methods described below in the Products
section through the command line. See the Examples
section in the individual products for more examples.
cd /path/to/project
python -m firststreet -p <product>.<product_subtype> -s <search_item>
-
-p/--product PRODUCT
: [REQUIRED] The product to call from the APIExample:
-p location.get_detail
-
[-api_key/--api_key API_KEY]
: [OPTIONAL] If step 1 is skipped or unavailable, this argument can take theAPI_KEY
instead.Example:
-a XXXXXXXXXXXXXXXXXXX
-
[-v/--version VERSION]
: [OPTIONAL] The version of the API to call. Defaults to the current version.Example:
-v v1
-
[-log/--log LOG]
: [OPTIONAL] To log info output to the console or not. Defaults to TrueExample:
-l False
-
[-connection_limit/--connection_limit CONNECTION_LIMIT]
: [OPTIONAL] The max number of concurrent connections to make to the API at the same time. This is does not affect the number of FSIDs that can be pulled. Defaults to 100 connectionsExample:
-connection_limit 20000
-
[-rate_limit/--rate_limit RATE_LIMIT]
: [OPTIONAL] The max number of requests during the rate limit period. Defaults to 20000 requestsExample:
-rate_limit 1
-
[-rate_period/--rate_period RATE_PERIOD]
: [OPTIONAL] The period of time for the rate limit. Defaults to 1 secondExample:
-rate_period 20
-
[-o/--output_dir OUTPUT_DIR]
: [OPTIONAL] The location to output the generated CSV or image. Defaults tooutput_data
in the working directory.Example:
-o new_output_location
-
[-s/--search_items SEARCH_ITEMS]
: [OPTIONAL] The Search Items to search for with the product.NOTE The search_item list must be separated with a semicolon (;) instead of a comma
Example:
-s 541114211;541229206
Example:-s "247 Water Street, New York, New York";"485 Lexington Avenue New York, New York"
Example:-s 40.754,-73.977;40.75682,-73.98037
-
[-l/--location_type LOCATION_TYPE]
: [OPTIONAL] The lookup location type (property, neighborhood, city, zcta, tract, county, cd, state)Example:
-l property
-
[-y/--year YEAR]
: [OPTIONAL] The year to use for theProbability Depth Tile
productExample:
-y 2050
-
[-rp/--return_period RETURN_PERIOD]
: [OPTIONAL] The return period to use for theProbability Depth Tile
productExample:
-rp 500
-
[-eid/--event_id EVENT_ID]
: [OPTIONAL] The event id to use for theHistoric Event Tile
productExample:
-eid 3
-
[-e/--extra_param EXTRA_PARAM]
: [OPTIONAL] Extra parameters used for specific products. Ex: To adjust the AAL calculations inaal.get_summary
Example:-eid 3
-
Installation
-
Usage
-
Products
-
Update