Enmscripting initialization error `Please make sure the URL is a valid ENM URL`

Hello everyone,

I recently discovered Ericsson enmscripting library they provide to consume their API to connect to ENM-cli via python script

I read their docummentation and I was hoping to be able to connect to the ENMs i use on my daily activities and write some scripts to make my life and my teams easier, but when I try to log into the library, I get the error in the topic subject (I am using the same url I use when I connect to the ENM on the web browser:

Please make sure the URL [https://enm.url:8005/] is a valid ENM URL

This is a small class I was writting to test the library which is the one giving me the error

class Enm_session:
    def __init__(self,url,user,password):
        self.url = url
        self.user = user
        self.password = password
    def init_session(self):
        self.session = enmscripting.open(self.url).with_credentials(enmscripting.UsernameAndPassword(self.user,self.password))
    def close_session(self):
        if self.session():
    def send_command(self,command):
        if self.session():
            cmd = self.session.command()
            response = cmd.execute(command)
            for element in response.get_output():
def main():
    url = r'https://enm.url:8005/'
    user = "myuser"
    pasword = "mypassword"
    enm = Enm_session(url,user,pasword)
    command = 'cmedit get MeContext=SampleNode'

As for requirementes I installed :

Package              Version
-------------------- --------
bcrypt               4.1.3
certifi              2024.2.2
cffi                 1.16.0
charset-normalizer   3.3.2
cryptography         42.0.7
enm-client-scripting 1.22.2
idna                 3.7
pip                  24.0
pycparser            2.22
PyNaCl               1.5.0
requests             2.32.0
six                  1.16.0
uplink               0.9.7
uritemplate          4.1.1
urllib3              2.2.1

and my Python version is 3.12.3

any insights? thanks

Admin note: this post was updated with image below.

Hi, @fcmarcoa, for some reason server https://enm.url:8005/ can not autheticate you. At first, check URL you are using. Then modify code for logging like this and check logs.

import logging

    format="%(levelname)-8s [%(asctime)s] %(message)s",

Hi @vlr9999 I did add logging to the script but the error is basically the same, just to confirm, I am using the exact same url i use everyday to log into enm via internet browser

INFO [2024-05-22 10:28:21,028] ENM opening session: https://enm.url:8005/, None
INFO [2024-05-22 10:28:21,028] ENM session is open: [https://enm.url:8005/][None][<enmscripting.private.session.ExternalSession object at 0x00000205FB85A1E0>]
ERROR [2024-05-22 10:28:21,892] Failed to open session. Please make sure the URL [https://enm.url:8005/] is a valid ENM URL

Make sure you are not behind firewall or proxy. I believe it is a network issue. You are failed here: