From 7e830af3785b462c78eb1b186b5a86c4cddf80dd Mon Sep 17 00:00:00 2001 From: Ipper18 <64928480+Ipper18@users.noreply.github.com> Date: Wed, 13 Mar 2024 20:34:09 +0100 Subject: [PATCH 1/2] Dziala wysylanie do zdalnej bazy --- connection.env | 2 +- traffic_monitor.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/connection.env b/connection.env index 6330a4c..2387a6f 100644 --- a/connection.env +++ b/connection.env @@ -1 +1 @@ -API_KEY=AIzaSyDjArNix8I0akx1uouwhcAO3743fLT6ncE \ No newline at end of file +API_KEY= \ No newline at end of file diff --git a/traffic_monitor.py b/traffic_monitor.py index 37a4662..41bca43 100644 --- a/traffic_monitor.py +++ b/traffic_monitor.py @@ -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)) @@ -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.") From 154b7fc08a95d048a1f40d0f85388566dd92752a Mon Sep 17 00:00:00 2001 From: Ipper18 <64928480+Ipper18@users.noreply.github.com> Date: Wed, 13 Mar 2024 20:49:33 +0100 Subject: [PATCH 2/2] =?UTF-8?q?Dzia=C5=82a=20po=C5=82=C4=85czenie=20z=20ba?= =?UTF-8?q?za=20zdalna?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- traffic_monitor.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/traffic_monitor.py b/traffic_monitor.py index 41bca43..c1c1cab 100644 --- a/traffic_monitor.py +++ b/traffic_monitor.py @@ -121,8 +121,3 @@ def calculate_route(api_key, start_coordinates, end_coordinates, routName, conne connection.close() - - - - -