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

Running the Library Through the a Python File

Kelvin edited this page Feb 22, 2021 · 5 revisions

1. Create a new Python script (by using notepad, any other text editor, IDE, etc) and initialize a First Street Foundation API Client.

[Reminder] Keep your API key safe, and do not share it with others!
[NOTE] This method will NOT generate a CSV by default. An argument must be passed to generate a CSV.

# Contents of my_script.py
import firststreet
fs = firststreet.FirstStreet("api-key")

Client Initialization Details

firststreet.FirstStreet(
    api_key, 
    connection_limit=100, 
    rate_limit=20000, 
    rate_period=1, 
    version=v1, 
    log=True
)

Arguments

  • api_key string: The assigned API key to access the API.
  • connection_limit int: The max number of connections to make
  • rate_limit int: The max number of requests during the specified rate_period
  • rate_period int: The period of time for the limit in seconds
  • version string: The version of the API to access. Defaults to the current version.
  • log bool, Setting for whether to log info or not. Defaults to True.

NOTE: If you are using Jupyter Notebook, you must add the following to the top of the file before the client initialization above to allow the jupyter notebook and download loops to work correctly

Example:

# Setup For Notebook only
import nest_asyncio
nest_asyncio.apply()

fs = firststreet.FirstStreet("api-key")

2. Call one of the methods described below in the Products section with the required arguments. See the Examples section in each product page for more examples.

fs.<product>.<product_subtype>(<search_items: list>, <lookup_type: string>, <csv: boolean>)

Screenshot

OR

Screenshot

Screenshot

3. Run the python script.

Screenshot

Clone this wiki locally