diff --git a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/integrations/HttpApiKeyAuth.java b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/integrations/HttpApiKeyAuth.java index 819cd2bf..2c58c7ed 100644 --- a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/integrations/HttpApiKeyAuth.java +++ b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/integrations/HttpApiKeyAuth.java @@ -63,8 +63,9 @@ public List getClientPlugins(GenerationContext context) { .initialize(writer -> { writer.addImport("smithy_http.aio.identity.apikey", "APIKeyIdentityResolver"); writer.write(""" - if api_key_identity_resolver is None: - api_key_identity_resolver = APIKeyIdentityResolver() + self.api_key_identity_resolver = ( + api_key_identity_resolver or APIKeyIdentityResolver() + ) """); }) .build())