Skip to content

[python-skills] the generated code fails to use context managers or close clients after use. #287

@xiangyan99

Description

@xiangyan99

This is one of the examples:

def main() -> None:
    client = get_client()

    try:
        # 1. Set a configuration setting
        set_configuration_setting(client)

        # 2. Set a setting with label "Production"
        set_labeled_setting(client)

        # 3. Get the setting by key and print its value
        get_setting(client)

        # 4. List all settings matching key filter "app:Settings:*"
        list_settings(client)

        # 5. Create a FeatureFlagConfigurationSetting
        set_feature_flag(client)

        # 6. Delete the setting by key
        delete_setting(client)

    except HttpResponseError as e:
        print(f"\nAzure HttpResponseError: {e.message}")
        print(f"Status code: {e.status_code}")
        sys.exit(1)
    finally:
        # Clean up all created settings
        try:
            cleanup(client)
        except HttpResponseError:
            pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions