Python Client#

This guide provides step-by-step instructions for setting up a Python virtual environment for developing and running a Dlubal API client. Using a virtual environment helps isolate dependencies and manage your Python projects efficiently.

Prerequisites#

Before starting, ensure your system meets the following requirements:

  1. Installed Python programming langugage (version 3.10 or later).

    • Verify the installation by running:

      python --version
      
  2. Installed Visual Studio Code as your code editor:

    • Verify the installation by running:

      code --version
      
  3. Installed Python Extension in VS Code:

    • Open the Extensions view by pressing Ctrl+Shift+X.

    • Search for Python and click on Install.

Setup Virtual Environment#

Follow these steps to create and configure a Python virtual environment for your project:

  1. Create the Virtual Environment:

    • Open a terminal in your project folder and run:

      python -m venv myenv
      
    • This creates a virtual environment named myenv in your project directory.

  2. Activate the Virtual Environment:

    • Activate the environment depending on your operating system:

      • On Windows:

        myenv\Scripts\activate
        
    • You should see (myenv) in your terminal, indicating the environment is active.

Install the Dlubal API Package#

  1. Install the Dlubal API Package:

    • Install the Dlubal API using pip:

      pip install dlubal.api
      
    • To install a specific version of the package, append the version number using the == specifier:

      pip install dlubal.api==<version>
      

    Important

    The API client version must match the version of your Dlubal application to ensure full compatibility. For example, API client version 2.10.8 corresponds to RFEM 6.10.0008 / RSTAB 9.10.0008.

  2. Verify the Installation:

    • Verify that the Dlubal API is installed correctly by running:

      pip list | grep dlubal
      

Using the Package#

from dlubal.api import rfem

with rfem.Application(api_key_value='your_api_key_value') as rfem_app:

    info = rfem_app.get_application_info()
    print(f'Version: {info.name}')