Is there a Python client library for interacting with Minerva?

Landon Mitchell Kanner
Landon Mitchell Kanner Member, Employee Posts: 291
25 Answers 100 Comments 25 Likes First Anniversary
✭✭✭✭

I would like to automate some tasks in Minerva using Python scripting. Is this possible?

Tagged:

Best Answer

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee Posts: 291
    25 Answers 100 Comments 25 Likes First Anniversary
    ✭✭✭✭
    Answer ✓

    Once you install the Minerva Transfer Client on your machine (in Minerva click on your initials in the upper-right corner > Tools > Application Launcher), you will have access to the Minerva SDK, which can be accessed in Python as follows:

    MinervaPath = r'C:\Program Files\Ansys Inc\Application Launcher\TransferClient'
    import sys
    import clr
    if not MinervaPath in sys.path:
        sys.path.append(MinervaPath)
    clr.AddReference("Ansys.Minerva.Sdk")
    import Ansys.Minerva.Sdk as minerva 
    

    Here is sample code to connect to instance of Minerva:

    connection = minerva.HttpConnection("https://cdcwisdom1.win.ansys.com/AnsysMinerva")
    connection.LoginAsync(minerva.BrowserLogin())
    

Answers

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee Posts: 291
    25 Answers 100 Comments 25 Likes First Anniversary
    ✭✭✭✭

    How to connect with username and password:

    try: creds = minerva.ExplicitCredentials("db_name","login_name",minerva.SecureToken("password")[0]) #IPython?
    except: creds = minerva.ExplicitCredentials("db_name","login_name",minerva.SecureToken("password")) #CPython?
    connection.Login(creds)