python-fmrest icon indicating copy to clipboard operation
python-fmrest copied to clipboard

Add examples for new perform_script method

Open davidhamann opened this issue 5 years ago • 2 comments

Current examples only show FMSv17 style of executing scripts.

TODO: Update examples.

davidhamann avatar Jun 05 '19 13:06 davidhamann

Any update on this? Looking for example performing script.

nexgen avatar Mar 16 '20 13:03 nexgen

Sorry, very busy lately and no time to spend on the docs. The code itself has lots of comments that could help in figuring out how to use it (find perform_script in fmrest/server.py and tests in tests/integration/test_server.py).

This would be a full example on how to perform a script using the new script route:

import fmrest

server = fmrest.Server(url=URL,
    user=ACCOUNT_NAME,
    password=ACCOUNT_PASS,
    database=DATABASE,
    layout=LAYOUT
)

with server as fms:
    fms.login()
    result = fms.perform_script('script-name', 'script-param')

result would then contain a tuple of error (0 for success) and the return value of the script.

You can also always access the last result via the last_script_result property, so in this case (fms.last_script_result).

Hope this gets you started. Feel free to ask again if you experience any issues.

davidhamann avatar Mar 16 '20 19:03 davidhamann