client.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:eureka 作者: wasp 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号