This program utilizes the Google Maps Geolocation API to retrieve location information based on the provided address. Follow the instructions below to set up the program and obtain the necessary API key.
- Go to the Google Cloud Console.
- Create a new project or select an existing project.
- In the Cloud Console, navigate to the "APIs & Services" > "Library" section.
- Search for "Geolocation API" and enable it for your project.
- In the Cloud Console, navigate to the "Billing" section.
- Enable billing for your project.
- In the Cloud Console, navigate to the "APIs & Services" > "Credentials" section.
- Create a new API Key.
- Restrict the API key if needed (e.g., restrict by IP address).
- Make note of the API Key; you will use it in the next steps.
- Create a file named
.env
in the root directory of your project. - Add the following line to the
.env
file, replacingyour_actual_api_key
with the API key obtained in the previous step:
GOOGLE_MAPS_API_KEY=your_actual_api_key
Save the file.
- Install required Python packages:
pip install -r requirements.txt
Run your Python script:
python main.py