fix person url

This commit is contained in:
dderbentsov
2023-08-07 23:53:12 +03:00
parent b25fdebdbf
commit 7075db3b49

View File

@@ -18,12 +18,12 @@ import httpx
class MedicalCardService(BaseService[models.MedicalCard, MedicalCardCreateIn, Any]):
def __init__(self, db_session: Session):
super(MedicalCardService, self).__init__(models.MedicalCard, db_session)
LOCAL_PERSONAL_INFO_URL = 'http://localhost:8001/persons'
LOCAL_PERSONAL_INFO_URL = 'http://localhost:8001'
self.PERSONAL_INFO_URL = os.environ.get('ASTRA-PESONAL-INFORMATION') or LOCAL_PERSONAL_INFO_URL
def get_persons(self, searchstring: str) -> List[PersonOut]:
try:
response = httpx.get(f'{self.PERSONAL_INFO_URL}/?full_name={searchstring}')
response = httpx.get(f'{self.PERSONAL_INFO_URL}/persons/?full_name={searchstring}')
response.raise_for_status()
except httpx.RequestError as exc:
print(f"Ошибка вызова {exc.request.url!r}.")