This project queries the TimezoneDB API to retrieve timezone data and populates the database with the obtained information. It consists of a Python script that interacts with the API, handles errors, and stores the data in the database.
- Retrieves timezone data from the TimezoneDB API
- Populates the
TZDB_TIMEZONESandTZDB_ZONE_DETAILStables in the database - Handles errors during API retrieval and logs them in the
TZDB_ERROR_LOGtable
- Python 3.10.6
- pip install SQLAlchemy
- pip install mysql-connector-python
- pip install mysqlclient
- MySQL database
- Clone the repository:
git clone https://github.com/marivfa/timezone_proyect.git-
Change into the project directory: cd timezone
-
Install the required dependencies pip install -r requirements.txt
Update the .env file with your TimezoneDB API key and database connection details.
Run the script to populate the database:
python main.py
The script will query the TimezoneDB API, retrieve timezone data, and populate the TZDB_TIMEZONES and TZDB_ZONE_DETAILS tables in the database.
python -m unittest tests.test_api_client