Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion connection.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
API_KEY=AIzaSyDjArNix8I0akx1uouwhcAO3743fLT6ncE
API_KEY=
9 changes: 2 additions & 7 deletions traffic_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def calculate_route(api_key, start_coordinates, end_coordinates, routName, conne
# ZAPIS DO BAZY DANYCH
cursor = connection.cursor()
insert_query = """
INSERT INTO traffic (data, dzien_tygodnia, godzina, nazwa_trasy, dystans, czas_minut)
INSERT INTO googletraffic.traffic (data, dzien_tygodnia, godzina, nazwa_trasy, dystans, czas_minut)
VALUES (%s, %s, %s, %s, %s, %s);
"""
cursor.execute(insert_query, (date, day_of_week, time_of_day, routName, distance, minute))
Expand All @@ -98,7 +98,7 @@ def calculate_route(api_key, start_coordinates, end_coordinates, routName, conne
load_dotenv(dotenv_path='connection.env')
api_key = os.getenv('API_KEY', default='')

connection = mysql.connector.connect(user='admin', password='admin', database='googletrafic', host='127.0.0.1', port='3306') # Uzupełnij swoimi danymi
connection = mysql.connector.connect(user='admin', password='Admin123', database='Googletraffic', host='34.118.70.238', port='3306') # Uzupełnij swoimi danymi

if not api_key:
print("API key not found. Check the connection.env file.")
Expand All @@ -121,8 +121,3 @@ def calculate_route(api_key, start_coordinates, end_coordinates, routName, conne
connection.close()