This is a command-line utility to fetch geolocation data (latitude, longitude, and place details) from OpenWeather Geocoding API based on city/state or ZIP code input. Fully specified task for this program development you can find here using a link
- Python 3.7+
pip
package manager
-
Clone the repository:
git clone <repository-url> cd <repository-folder>
-
Create and activate a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows use: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
Run the command with the --locations
flag followed by city/state or ZIP codes:
python geolocation_utility.py --locations Madison, WI 10001
Example output:
{"name": "Madison", "lat": 43.0731, "lon": -89.4012, "state": "Wisconsin"}
{"zip": "10001", "lat": 40.7128, "lon": -74.0060, "city": "New York"}
- Ensure dependencies are installed (see Installation section).
- Run tests from the core project folder using pytest:
pytest
- This utility only supports locations within the United States.
- It uses the OpenWeather Geocoding API.
This project is open-source and available under the MIT License.