diff --git a/mailling/config.env b/mailling/config.env new file mode 100644 index 0000000..0c18c3e --- /dev/null +++ b/mailling/config.env @@ -0,0 +1,3 @@ +API_BASE_URL=https://api.marcoaiot.com/api +USERNAME=admin@marcoaiot.com +PASSWORD=User@123 \ No newline at end of file diff --git a/mailling/localhost/config.env b/mailling/localhost/config.env deleted file mode 100644 index 6371db7..0000000 --- a/mailling/localhost/config.env +++ /dev/null @@ -1,4 +0,0 @@ -PROJECT_IDS=2618eb89-2823-11f0-9d9e-bc241163f504,08dd9d0d-2ac4-4789-840e-77fa48f55d40,2618f2ef-2823-11f0-9d9e-bc241163f504 -BASE_URL=http://localhost:5032/api -USERNAME=admin@marcoaiot.com -PASSWORD=User@123 \ No newline at end of file diff --git a/mailling/localhost/localhost_project_report.py b/mailling/localhost/localhost_project_report.py deleted file mode 100644 index 934310c..0000000 --- a/mailling/localhost/localhost_project_report.py +++ /dev/null @@ -1,42 +0,0 @@ -import requests -from dotenv import load_dotenv -import os - -load_dotenv(dotenv_path="config.env", override=True) - -base_url = os.getenv("BASE_URL") -def login(): - payload = { - "username": os.getenv("USERNAME"), - "password": os.getenv("PASSWORD") - } - - headers = { - "Content-Type": "application/json" - } - - response = requests.post(f"{base_url}/auth/login",json=payload,headers=headers) - - data = response.json()['data'] - jwt = data["token"] - return jwt - -def project_proccess(jwt): - headers = { - "Authorization": f"Bearer {jwt}", - "Content-Type": "application/json" - } - response = requests.get(f"{base_url}/report/project-statistics", headers=headers) - return response - -try: - jwt = login() - response = project_proccess(jwt) # Call your function - - if response.status_code == 200: - print("Email sent") - else: - print(f"Failed with response: {response}") -except Exception as e: - print(f"An error occurred: {e}") - diff --git a/mailling/prod/config.env b/mailling/prod/config.env deleted file mode 100644 index cee10f1..0000000 --- a/mailling/prod/config.env +++ /dev/null @@ -1,4 +0,0 @@ -PROJECT_IDS=2618eb89-2823-11f0-9d9e-bc241163f504,08dd9d0d-2ac4-4789-840e-77fa48f55d40,2618f2ef-2823-11f0-9d9e-bc241163f504 -BASE_URL=https://api.marcoaiot.com/api -USERNAME=admin@marcoaiot.com -PASSWORD=User@123 \ No newline at end of file diff --git a/mailling/prod/prod_project_report.py b/mailling/prod/prod_project_report.py deleted file mode 100644 index 934310c..0000000 --- a/mailling/prod/prod_project_report.py +++ /dev/null @@ -1,42 +0,0 @@ -import requests -from dotenv import load_dotenv -import os - -load_dotenv(dotenv_path="config.env", override=True) - -base_url = os.getenv("BASE_URL") -def login(): - payload = { - "username": os.getenv("USERNAME"), - "password": os.getenv("PASSWORD") - } - - headers = { - "Content-Type": "application/json" - } - - response = requests.post(f"{base_url}/auth/login",json=payload,headers=headers) - - data = response.json()['data'] - jwt = data["token"] - return jwt - -def project_proccess(jwt): - headers = { - "Authorization": f"Bearer {jwt}", - "Content-Type": "application/json" - } - response = requests.get(f"{base_url}/report/project-statistics", headers=headers) - return response - -try: - jwt = login() - response = project_proccess(jwt) # Call your function - - if response.status_code == 200: - print("Email sent") - else: - print(f"Failed with response: {response}") -except Exception as e: - print(f"An error occurred: {e}") - diff --git a/mailling/stage/stage_project_report.py b/mailling/project_daily_status_report.py similarity index 96% rename from mailling/stage/stage_project_report.py rename to mailling/project_daily_status_report.py index 934310c..171fcf5 100644 --- a/mailling/stage/stage_project_report.py +++ b/mailling/project_daily_status_report.py @@ -4,7 +4,7 @@ import os load_dotenv(dotenv_path="config.env", override=True) -base_url = os.getenv("BASE_URL") +base_url = os.getenv("API_BASE_URL") def login(): payload = { "username": os.getenv("USERNAME"), diff --git a/mailling/stage/config.env b/mailling/stage/config.env deleted file mode 100644 index 0ebd944..0000000 --- a/mailling/stage/config.env +++ /dev/null @@ -1,4 +0,0 @@ -PROJECT_IDS=2618eb89-2823-11f0-9d9e-bc241163f504,08dd9d0d-2ac4-4789-840e-77fa48f55d40,2618f2ef-2823-11f0-9d9e-bc241163f504 -BASE_URL=https://stageapi.marcoaiot.com/api -USERNAME=admin@marcoaiot.com -PASSWORD=User@123 \ No newline at end of file