def _do_req(self, path: str, *, method: str = 'GET',
data: Optional[Any] = None):
"""
Performs a request against the instance eureka server.
:param path: URL Path, the hostname is prepended automatically
:param method: request method (put/post/patch/get/etc)
:param data: Optional data to be sent with the request, must
already be encoded appropriately.
:return: optional[dict[str, any]]
"""
url = self._eureka_url + path
logger.debug('Performing %s on %s with payload: %s', method, path,
data)
async with _SESSION.request(method, url, data=data) as resp:
if 400 <= resp.status < 600:
# noinspection PyArgumentList
raise EurekaException(HTTPStatus(resp.status),
await resp.text())
logger.debug('Result: %s', resp.status)
return await resp.json()
评论列表
文章目录