Secrets & Global Site Configuration

This commit is contained in:
Quentin WEPHRE
2024-11-21 16:07:03 +01:00
parent 1a383c5302
commit 034507434d
7 changed files with 115 additions and 78 deletions

View File

@@ -5,6 +5,10 @@ import requests
from urllib3.exceptions import InsecureRequestWarning
import jq
import json
import os
from dotenv import load_dotenv
load_dotenv()
# Function to authenticate and get token
def authenticate(device_ip, payload):
@@ -106,10 +110,13 @@ def get_API_1(device_ip, token):
requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)
default_user = str(os.getenv("DEFAULT_MOXA_USER"))
default_password = str(os.getenv("DEFAULT_MOXA_PASSWORD"))
payload_auth = {
"acceptEULA": True,
"name": "",
"password": ""
"name": default_user,
"password": default_password
}
if payload_auth["name"] == "" or payload_auth["password"] == "":
print("Provide the credentials before running the script!")