@@ -147,10 +147,6 @@ def __init__(
147
147
config = SearchConfig (transporter .config .app_id , transporter .config .api_key )
148
148
elif config is None :
149
149
config = SearchConfig (app_id , api_key )
150
- elif config .region is not None :
151
- self ._ingestion_transporter = IngestionClient .create_with_config (
152
- IngestionConfig (config .app_id , config .api_key , config .region )
153
- )
154
150
155
151
self ._config = config
156
152
self ._request_options = RequestOptions (config )
@@ -179,13 +175,27 @@ def create_with_config(
179
175
if transporter is None :
180
176
transporter = Transporter (config )
181
177
182
- return SearchClient (
178
+ client = SearchClient (
183
179
app_id = config .app_id ,
184
180
api_key = config .api_key ,
185
181
transporter = transporter ,
186
182
config = config ,
187
183
)
188
184
185
+ if config .region is not None :
186
+ ingestion_config = IngestionConfig (
187
+ config .app_id , config .api_key , config .region
188
+ )
189
+
190
+ if config .hosts is not None :
191
+ ingestion_config .hosts = config .hosts
192
+
193
+ client ._ingestion_transporter = IngestionClient .create_with_config (
194
+ ingestion_config
195
+ )
196
+
197
+ return client
198
+
189
199
async def __aenter__ (self ) -> Self :
190
200
return self
191
201
@@ -5289,10 +5299,6 @@ def __init__(
5289
5299
config = SearchConfig (transporter .config .app_id , transporter .config .api_key )
5290
5300
elif config is None :
5291
5301
config = SearchConfig (app_id , api_key )
5292
- elif config .region is not None :
5293
- self ._ingestion_transporter = IngestionClientSync .create_with_config (
5294
- IngestionConfig (config .app_id , config .api_key , config .region )
5295
- )
5296
5302
5297
5303
self ._config = config
5298
5304
self ._request_options = RequestOptions (config )
@@ -5321,13 +5327,27 @@ def create_with_config(
5321
5327
if transporter is None :
5322
5328
transporter = TransporterSync (config )
5323
5329
5324
- return SearchClientSync (
5330
+ client = SearchClientSync (
5325
5331
app_id = config .app_id ,
5326
5332
api_key = config .api_key ,
5327
5333
transporter = transporter ,
5328
5334
config = config ,
5329
5335
)
5330
5336
5337
+ if config .region is not None :
5338
+ ingestion_config = IngestionConfig (
5339
+ config .app_id , config .api_key , config .region
5340
+ )
5341
+
5342
+ if config .hosts is not None :
5343
+ ingestion_config .hosts = config .hosts
5344
+
5345
+ client ._ingestion_transporter = IngestionClientSync .create_with_config (
5346
+ ingestion_config
5347
+ )
5348
+
5349
+ return client
5350
+
5331
5351
def __enter__ (self ) -> Self :
5332
5352
return self
5333
5353
0 commit comments