- Navigate to the Code folder.
- Run the following command to install the required dependencies:
pip install -r requirements.txt
- (Make sure Python is installed on your system)
- Open weather.py and add your API key in the first line between the quotes (
''
), which you can obtain from openweathermap.org.
- Log in to your MySQL database:
Enter the password when prompted.
mysql -u root -p
- Create a new database:
CREATE DATABASE python_app_cli;
- Create a new user and grant privileges:
CREATE USER 'weather_cli'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON python_app_cli.* TO 'weather_cli'@'localhost'; FLUSH PRIVILEGES;
- In the Code Folder, open a terminal (cmd) and run:
python main.py
- Login/Signup:
- Enter userID and password to log in.
- If you don't have an account, select 2 to sign up (name, password, unique userID, mobile, and security_phrase required).
- Password Reset:
- If you've forgotten your password, select 3 to reset it using your userID and security phrase.
- User Interface After Login:
After logging in, you’ll see the number of API calls left (out of 20) at the top.- View Profile: Displays your name, mobile number, and user ID.
- Fetch Weather Data: Enter the city, state, and country to retrieve the weather data. This will be saved to the WEATHER_LOGS database.
- View Logs: Shows previously viewed weather logs with timestamps.
- Delete Logs: Allows you to delete specific logs using the row ID.
- Log Out: Logs out and returns you to the login/signup section.
- Unique User IDs: User IDs must be unique. If a userID already exists, you will be prompted to choose a new one.
- Password Validation:
- Password must be at least 8 characters long.
- Must contain at least one lowercase letter, one uppercase letter, one digit, and one special symbol.
- Mobile Number: Must be 10 digits long (Indian mobile number format).
- Security Phrase: Used to reset your password. Both password and security phrase are hashed using SHA-256 before being stored.
- Users can make a maximum of 20 API calls in a 24-hour period. Once the API call limit reaches 0, you will not be able to make further requests until the next 24-hour cycle.
Attribute | Type | Description |
---|---|---|
u_ID | Varchar | Stores the unique user ID of the user. |
name | Varchar | Stores the user's name. |
password | Char | Stores the hashed password (SHA-256). |
mobile | Varchar | Stores the user's mobile number. |
security_phrase | Char | Stores the hashed security phrase (SHA-256). |
Attribute | Type | Description |
---|---|---|
id | Int | Primary key to uniquely identify each record. |
user_id | Varchar | Foreign key to the USERS table, linking each record to a specific user. |
last_update | Timestamp | Stores the timestamp when the API call count resets (every 24 hours). |
request_count | Int | Keeps track of the user's remaining API call count (maximum of 20 per 24 hours). |
Attribute | Type | Description |
---|---|---|
id | Int | Primary key, used to uniquely identify weather log records. |
timestamp | Datetime | Timestamp when the API call was made. |
location | Varchar | The city/state/country searched for weather information. |
temperature | Varchar | Temperature in Celsius for the specified location. |
humidity | Varchar | Humidity level for the specified location. |
weather_conditions | Varchar | Weather conditions (e.g., cloudy, rainy, sunny) for the specified location. |
wind_speed | Varchar | Wind speed for the specified location. |
u_ID | Varchar | Foreign key to the USERS table, indicating which user made the request. |