A command-line interface tool that provides various web service integrations including weather lookup, NFL scores, news aggregation, economic indicators, tide information, and earthquake data.
-
Weather lookup by address
- Converts addresses to coordinates using Census Geocoding API
- Fetches detailed weather data from National Weather Service API
- Stores recent lookups in local SQLite database (
history.db) - Generates Google Maps links for looked-up addresses
-
Sports Scores
- Real-time game scores from ESPN API for multiple leagues:
- NFL (National Football League)
- MLB (Major League Baseball)
- NHL (National Hockey League)
- NBA (National Basketball Association)
- MLS (Major League Soccer)
- NCAA College Football
- Shows upcoming, in-progress, and completed games
- Displays current game period and score for live games
- Real-time game scores from ESPN API for multiple leagues:
-
News Aggregation
- Fetches latest news articles using Google News
- Filter articles by specific domains (e.g., wsj.com)
- Displays article titles, publication dates, and URLs
- Limited to 5 most recent articles per query
- Includes default news sites (wsj.com, washingtonpost.com, nytimes.com, apnews.com, whitehouse.gov)
- Saves user-entered domains to the database for future use
- Organizes news sources into "Default News Sites" and "Saved News Sites" categories
-
BLS Economic Indicators
- Retrieves key economic indicators from the BLS API
- Includes CPI, CPI less food and energy, PPI, Nonfarm payroll, and Unemployment rate
- Displays data in a format preferred by financial analysts, including month-over-month changes and actual values
-
Tide Information
- Converts address to coordinates using Census Geocoding API
- Finds the nearest NOAA tide station and displays its information (name, ID, coordinates)
- Generates a Google Maps link for the tide station
- Retrieves tide predictions from NOAA API
- Displays high and low tide times and types
-
Querying Salesforce contacts
- Checks for
SALESFORCE_USERNAME,SALESFORCE_PASSWORD, andSALESFORCE_SECURITY_TOKENenvironment variables. - Attempts authentication using environment variables if set.
- If environment variables are not set or authentication fails, instructs the user to set/check them.
- Retrieves contact records based on filter criteria.
- Checks for
-
Earthquake Information
- Retrieves last 24 hours 5.0 earthquake data from the USGS Earthquake API
- Displays earthquake magnitude, location, and time
- Filters results by minimum magnitude and time range
-
US Federal Reserve (FRED) Indicators
- Checks for
FRED_API_KEYenvironment variable. - Fetches and displays key economic indicators from the FRED API if the key is set.
- Indicators include: Effective Federal Funds Rate, 10-Year Treasury Rate, M2 Money Stock, Industrial Production, GDP, CPI, Unemployment Rate, Mortgage Rates, Housing Starts, Consumer Sentiment, Initial Claims, and Home Price Index.
- Shows the latest value, its date, and the change from the previous observation.
- Checks for
This project uses DevContainers for development. To get started:
- Install Docker and VS Code
- Open the project in VS Code
- Install the "Remote - Containers" extension
- Click "Reopen in Container" when prompted
The container will automatically install all dependencies and start the application.
Alternatively, you can set up manually:
# Clone the repository
git clone <repository-url>
cd py-poly-cli
# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtRun the application:
python3 poly_cli.pyIf using a dev container, the application is started automatically.
Navigate through the menus to:
- Look up weather for a new address or select from recent lookups
- View live sports scores for various leagues (NFL, MLB, NHL, NBA, MLS, College Football)
- Browse latest news articles from specific domains
- Enter a new domain or select from default/saved news sites
- Default sites include: wsj.com, washingtonpost.com, nytimes.com, apnews.com, whitehouse.gov
- View latest economic indicators from the BLS
- Look up tide information by address
- Query Salesforce contacts
- View recent earthquake information
- View US Federal Reserve (FRED) economic indicators
- Exit the application
The application features graceful exit handling with Ctrl+C and Ctrl+D, allowing you to exit safely from any menu.
To use the Salesforce and Federal Reserve APIs, you will need to set the following environment variables:
SALESFORCE_USERNAME: Your Salesforce username.SALESFORCE_PASSWORD: Your Salesforce password.SALESFORCE_SECURITY_TOKEN: Your Salesforce security token.FRED_API_KEY: Your FRED API key for accessing economic indicators.
When using the provided Dev Container, these variables can be configured in your local environment and will be passed into the container. Refer to the .devcontainer/devcontainer.json file for more details on how these are sourced.
- Census Geocoding Services - Convert addresses to coordinates
- National Weather Service API - Weather data and forecasts
- ESPN API - NFL scores and game information
- Google News - News article aggregation via GNews library
- BLS API - Economic indicators data
- NOAA Tides and Currents API - Tide predictions
- simple_salesforce - A basic Salesforce.com REST API client for Python.
- GitHub Repository
- USGS Earthquake API - Recent earthquake data
- FRED API (Federal Reserve Economic Data) - US economic indicators
- SQLite database (
history.db) stores:- Weather search history (addresses, coordinates)
- News site URLs (both default and user-saved)
- DevContainer Specification - Learn about DevContainer configuration
- Python 3.11+
- Docker (for development container)
- Required Python packages (included in requirements.txt):
- requests: For API calls
- halo: For terminal spinners
- python-dateutil: For date parsing and formatting
- gnews: For Google News integration
- simple_salesforce: For Salesforce API interaction