/
ksilisk
/
spbtechrun_hack
Обзор
Документация
Войти
/
ksilisk
/
spbtechrun_hack
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
python/mcp/mypets_client.py
49 строк
2 KB
Shaliko Salimov
fixed api clients
05 дек 2025, 21:03
05 дек 2025, 21:03
f536349
Код
Авторство
О чём код?
from __future__ import annotations from base_client import YazzhBaseClient from mappers import map_pet_shelters, map_pet_walking_areas, map_vet_clinics from yazzh import PetShelter, PetVetClinic, PetWalkingArea class MyPetsClient(YazzhBaseClient): """Клиент раздела «Мой питомец» (/mypets/*).""" async def list_vet_clinics( self, *, district: str | None = None, page: int = 1, count: int = 3 ) -> list[ PetVetClinic]: params = { "type": "Ветклиника", "page": page, "count": count, } if district is not None and district != "": params["district"] = district payload = await self._get("/mypets/all-category/", params=params) return map_vet_clinics(payload) async def list_shelters( self, *, district: str | None = None, page: int = 1, count: int = 3 ) -> list[PetShelter]: params = { "type": "Приют", "page": page, "count": count, } if district is not None and district != "": params["district"] = district payload = await self._get("/mypets/all-category/", params=params) return map_pet_shelters(payload) async def list_walking_areas( self, *, district: str | None = None, page: int = 1, count: int = 3 ) -> list[PetWalkingArea]: params = { "type": "Площадка", "page": page, "count": count, } if district is not None and district != "": params["district"] = district payload = await self._get("/mypets/all-category/", params=params) return map_pet_walking_areas(payload)