@@ -138,15 +138,17 @@ private static List<ConfigProperty> getHttpProperties(GenerationContext context)
138
138
if (usesHttp2 (context )) {
139
139
clientBuilder
140
140
.initialize (writer -> {
141
- writer .addDependency (SmithyPythonDependency .SMITHY_HTTP .withOptionalDependencies ("awscrt" ));
141
+ writer .addDependency (SmithyPythonDependency .SMITHY_HTTP );
142
+ writer .addDependency (SmithyPythonDependency .AWS_CRT );
142
143
writer .addImport ("smithy_http.aio.crt" , "AWSCRTHTTPClient" );
143
144
writer .write ("self.http_client = http_client or AWSCRTHTTPClient()" );
144
145
});
145
146
146
147
} else {
147
148
clientBuilder
148
149
.initialize (writer -> {
149
- writer .addDependency (SmithyPythonDependency .SMITHY_HTTP .withOptionalDependencies ("aiohttp" ));
150
+ writer .addDependency (SmithyPythonDependency .SMITHY_HTTP );
151
+ writer .addDependency (SmithyPythonDependency .AIO_HTTP );
150
152
writer .addImport ("smithy_http.aio.aiohttp" , "AIOHTTPClient" );
151
153
writer .write ("self.http_client = http_client or AIOHTTPClient()" );
152
154
});
@@ -171,11 +173,12 @@ private static boolean usesHttp2(GenerationContext context) {
171
173
return true ;
172
174
}
173
175
174
- // Bidirectional streaming REQUIRES h2 inherently
176
+ // enable CRT/http2 client if the service supports any event streams (single or bi-directional)
177
+ // TODO: Long term, only bi-directional evenstreams strictly require h2
175
178
var eventIndex = EventStreamIndex .of (context .model ());
176
179
var topDownIndex = TopDownIndex .of (context .model ());
177
180
for (OperationShape operation : topDownIndex .getContainedOperations (context .settings ().service ())) {
178
- if (eventIndex .getInputInfo (operation ).isPresent () && eventIndex .getOutputInfo (operation ).isPresent ()) {
181
+ if (eventIndex .getInputInfo (operation ).isPresent () || eventIndex .getOutputInfo (operation ).isPresent ()) {
179
182
return true ;
180
183
}
181
184
}
0 commit comments