For AI agents: the complete documentation index is available at https://docs.ovhcloud.com/es/llms.txt, the full documentation bundle is available at https://docs.ovhcloud.com/es/llms-full.txt, and this page is available as Markdown at https://docs.ovhcloud.com/es/guides/public-cloud/data-platform/developers-python-sdk-use-environment-variables.md.

Use environment variables in a Custom action

Ver como Markdown

Set environment variables for a Custom action in the preferences or in the JSON advanced mode

Objective

In a Custom action, you might want to use environment variables. You can set your own in the preferences or set them in the JSON Advanced Mode of the action, in the params JSON object, and re-use them in your custom action.

import sys
from logging import getLogger
from forepaas.core.settings import PARAMS

logger = logging.getLogger(__name__)

def my_custom(event):
	try:
		# Show the parameter value
		logger.info("Environment variable value is: ".format(PARAMS["env variable key"]))

	except Exception as err: 
		raise Exception("err:{} L:{}".format(err,sys.exc_info()[2].tb_lineno))

Go further

For training or technical assistance implementing our solutions, contact your sales representative or visit our Professional Services page to request a quote and have your project analysed by our experts.

Ask questions, give your feedback and interact directly with the team building the Data Platform on the dedicated Discord channel.

If you need support with your OVHcloud services, create a request in our Help Centre.

Join our community of users.

¿Le ha resultado útil esta página?