Skip to content

Bases

Events Application base class

get_descriptor() -> dict classmethod

Returns the extension.json extension descriptor.

Example

{
    'name': 'My extension',
    'description': 'This extension My Extension',
    'version': '1.0.0',
    'audience': ['distributor', 'vendor', 'reseller'],
    'readme_url': 'https://example.org/README.md',
    'changelog_url': 'https://example.org/CHANGELOG.md',
    'icon': 'bar_chart',
}

get_django_secret_key_variable() -> str classmethod

Returns the name of the environment variable that stores the Anvil Server Uplink key.

get_variables() -> dict classmethod

Inspects the Events Application class returning the list of environment variables declared using the @variables class decorator.

Example

[
    {
        'name': 'MY_ENV_VAR',
        'initial_value': '<<change me>>',
        'secure': False,
    },
    {
        'name': 'MY_SECURE_ENV_VAR',
        'initial_value': '<<change me>>',
        'secure': True,
    },
]

Base class to implements an Events Application.

get_events() -> dict classmethod

Inspects the Events Application class for methods decorated with the @event decorator and return a list of objects like in the following example:

Example

[
    {
        'method': 'handle_purchase_request',
        'event_type': 'asset_purchase_request_processing',
        'statuses': ['pending', 'approved'],
    },
]

get_schedulables() -> dict classmethod

Inspects the Events Application class for methods decorated with the @schedulable decorator and return a list of objects like in the following example:

Example

[
    {
        'method': 'refresh_oauth_token',
        'name': 'Refresh OAuth Token',
        'description': 'This schedulable refresh the GCP OAuth toke',
    },
]

Web Application base class

get_descriptor() -> dict classmethod

Returns the extension.json extension descriptor.

Example

{
    'name': 'My extension',
    'description': 'This extension My Extension',
    'version': '1.0.0',
    'audience': ['distributor', 'vendor', 'reseller'],
    'readme_url': 'https://example.org/README.md',
    'changelog_url': 'https://example.org/CHANGELOG.md',
    'icon': 'bar_chart',
}

get_django_secret_key_variable() -> str classmethod

Returns the name of the environment variable that stores the Anvil Server Uplink key.

get_variables() -> dict classmethod

Inspects the Events Application class returning the list of environment variables declared using the @variables class decorator.

Example

[
    {
        'name': 'MY_ENV_VAR',
        'initial_value': '<<change me>>',
        'secure': False,
    },
    {
        'name': 'MY_SECURE_ENV_VAR',
        'initial_value': '<<change me>>',
        'secure': True,
    },
]

Base class to implements an Events Application.

get_proxied_connect_api() -> Union[List[str], Dict] classmethod

Inspects the Web Application class returning the configuration of accessible Connect Public API endpoints declared using the @proxied_connect_api class decorator.

Example

[
    '/public/v1/marketplaces',
    '/public/v1/auth/context',
]

get_routers() -> tuple classmethod

Inspect the Web Application class for routes and return a tuple or two routers, the first one contains authenticated API routes, the second the non-authenticated ones.

Warning

Non authenticated endpoints must be authorized by CloudBlue. If your extension need to expose some, please contact the CloudBlue support.

get_static_root() classmethod

Returns the absolute path to the static root folder.

Anvil Application base class

get_descriptor() -> dict classmethod

Returns the extension.json extension descriptor.

Example

{
    'name': 'My extension',
    'description': 'This extension My Extension',
    'version': '1.0.0',
    'audience': ['distributor', 'vendor', 'reseller'],
    'readme_url': 'https://example.org/README.md',
    'changelog_url': 'https://example.org/CHANGELOG.md',
    'icon': 'bar_chart',
}

get_django_secret_key_variable() -> str classmethod

Returns the name of the environment variable that stores the Anvil Server Uplink key.

get_variables() -> dict classmethod

Inspects the Events Application class returning the list of environment variables declared using the @variables class decorator.

Example

[
    {
        'name': 'MY_ENV_VAR',
        'initial_value': '<<change me>>',
        'secure': False,
    },
    {
        'name': 'MY_SECURE_ENV_VAR',
        'initial_value': '<<change me>>',
        'secure': True,
    },
]

Base class to implements an Anvil Application.

get_anvil_callables() classmethod

Inspect the Anvil Application class to searching for method decorated with the @anvil_callable decorator and return a list of discovered anvil callable like in the following example:

Example

[
    {
        'method': 'my_anvil_callable',
        'summary': 'This callable sum two integer.',
        'description': 'Example anvil callable.',
    },
]

get_anvil_key_variable() -> str classmethod

Returns the name of the environment variable that stores the Anvil Server Uplink key.

setup_anvil_callables()

Setup the Anvil Server Uplink instance with the discovered Anvil callables.