Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add examples for new perform_script method #9

Open
davidhamann opened this issue Jun 5, 2019 · 2 comments
Open

Add examples for new perform_script method #9

davidhamann opened this issue Jun 5, 2019 · 2 comments

Comments

@davidhamann
Copy link
Owner

Current examples only show FMSv17 style of executing scripts.

TODO: Update examples.

@nexgen
Copy link

nexgen commented Mar 16, 2020

Any update on this? Looking for example performing script.

@davidhamann
Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants