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

Scripting get_variable method not implemented #160

Open
zDavidB opened this issue Dec 31, 2024 · 0 comments
Open

Scripting get_variable method not implemented #160

zDavidB opened this issue Dec 31, 2024 · 0 comments

Comments

@zDavidB
Copy link

zDavidB commented Dec 31, 2024

The docs Scripting contains a reference to the posting.get_variable() method, but it doesn't look like this has been implemented (yet).

As a workaround, looks like we could use vars = posting.variables and process the dict returned.
e.g.

from posting import Posting
import json

def setup(posting: Posting) -> None:
	
	auth_token="auth_token"
	
	# Capture the variables currently set
	vars = posting.variables
	# Check to see if auth token is set
	if not auth_token in vars:
		print(f"{auth_token} not found")
		posting.set_variable(auth_token, "1234567890")
	
		# Debug - dump the updated variables
		vars = posting.variables	
		print(f"Vars: {json.dumps(vars, sort_keys=True, indent=4)}")
		
		# Debug to see the var is set.
		print(f"Auth: {vars[auth_token]}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant