diff --git a/plesklogin.py b/plesklogin.py index 753b660..ac19d51 100644 --- a/plesklogin.py +++ b/plesklogin.py @@ -117,21 +117,15 @@ def oidc_callback(): "HTTP_PRETTY_PRINT": "TRUE", # Hey, it's pretty! } - # Add the API key or username and password to the request headers + # Add the username and password to the request headers - api_key = config["PLESK"].get( - "APIKey", fallback=os.environ.get("PLESK_API_KEY")) - - if api_key: - headers["X-API-Key"] = api_key - else: - plesk_login = config["PLESK"].get( - "Username", fallback=os.environ.get("PLESK_USERNAME")) - plesk_password = config["PLESK"].get( - "Password", fallback=os.environ.get("PLESK_PASSWORD")) - - headers["HTTP_AUTH_LOGIN"] = plesk_login - headers["HTTP_AUTH_PASSWD"] = plesk_password + plesk_login = config["PLESK"].get( + "Username", fallback=os.environ.get("PLESK_USERNAME")) + plesk_password = config["PLESK"].get( + "Password", fallback=os.environ.get("PLESK_PASSWORD")) + + headers["HTTP_AUTH_LOGIN"] = plesk_login + headers["HTTP_AUTH_PASSWD"] = plesk_password # If "VerifySSL" is set to "False" in the configuration, disable SSL verification diff --git a/settings.dist.ini b/settings.dist.ini index a659604..77f2daa 100644 --- a/settings.dist.ini +++ b/settings.dist.ini @@ -17,16 +17,9 @@ # Domain = plesk.local -# You need to use an API key to access the Plesk API -# Check the Plesk documentation for how to create one -# https://docs.plesk.com/en-US/obsidian/api-rpc/about-rest-api.79359/#api-keys -# You can also leave this blank and set the environment variable PLESK_API_KEY instead - -# APIKey = YourAPIKey - -# Alternatively, you can use your Plesk admin account +# You need to use an admin account to access the Plesk API # Is that a security risk? Yes. -# You can leave these values blank and set the environment variables PLESK_DOMAIN, PLESK_USERNAME, PLESK_PASSWORD instead +# You can leave these values blank and set the environment variables PLESK_USERNAME, PLESK_PASSWORD instead # Username = your_admin_account # Password = your_admin_password