@@ -307,20 +307,24 @@ async def get_by_name(self, tenant: Union[str, Tenant]) -> Optional[TenantOutput
307307 `weaviate.UnexpectedStatusCodeError`
308308 If Weaviate reports a non-OK status.
309309 """
310- self ._connection ._weaviate_version .check_is_at_least_1_25_0 ("The 'get_by_name' method" )
311310 if self ._validate_arguments :
312311 _validate_input (
313312 _ValidateArgument (expected = [Union [str , Tenant ]], name = "tenant" , value = tenant )
314313 )
315- response = await self ._grpc .get (
316- names = [tenant .name if isinstance (tenant , Tenant ) else tenant ]
314+ tenant_name = tenant .name if isinstance (tenant , Tenant ) else tenant
315+ response = await self ._connection .get (
316+ path = f"/schema/{ self ._name } /tenants/{ tenant_name } " ,
317+ error_msg = f"Could not get tenant { tenant_name } for collection { self ._name } " ,
318+ status_codes = _ExpectedStatusCodes (
319+ ok_in = [200 , 404 ], error = f"Get tenant { tenant_name } for collection { self ._name } "
320+ ),
317321 )
318- if len ( response .tenants ) == 0 :
322+ if response .status_code == 404 :
319323 return None
320- return Tenant (
321- name = response . tenants [ 0 ]. name ,
322- activity_status = self . _grpc . map_activity_status ( response . tenants [ 0 ]. activity_status ),
323- )
324+ data = response . json ()
325+ if not data :
326+ return None
327+ return Tenant ( ** data )
324328
325329 async def update (
326330 self , tenants : Union [TenantUpdateInputType , Sequence [TenantUpdateInputType ]]
0 commit comments