Removed unnessary python scripts
This commit is contained in:
parent
648af3a5c7
commit
d6ae3e4cf2
3
mailling/config.env
Normal file
3
mailling/config.env
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
API_BASE_URL=https://api.marcoaiot.com/api
|
||||||
|
USERNAME=admin@marcoaiot.com
|
||||||
|
PASSWORD=User@123
|
@ -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
|
|
@ -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}")
|
|
||||||
|
|
@ -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
|
|
@ -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}")
|
|
||||||
|
|
@ -4,7 +4,7 @@ import os
|
|||||||
|
|
||||||
load_dotenv(dotenv_path="config.env", override=True)
|
load_dotenv(dotenv_path="config.env", override=True)
|
||||||
|
|
||||||
base_url = os.getenv("BASE_URL")
|
base_url = os.getenv("API_BASE_URL")
|
||||||
def login():
|
def login():
|
||||||
payload = {
|
payload = {
|
||||||
"username": os.getenv("USERNAME"),
|
"username": os.getenv("USERNAME"),
|
@ -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
|
|
Loading…
x
Reference in New Issue
Block a user