client.py 文件源码

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

项目:rauc-hawkbit 作者: rauc 项目源码 文件源码
def put_resource(self, api_path, data, **kwargs):
        """
        Helper method for HTTP PUT API requests.

        Args:
            api_path(str): REST API path
            data: JSON data for POST request
        Keyword Args:
            kwargs: keyword args used for replacing items in the API path
        """
        put_headers = {
            'Content-Type': 'application/json',
            **self.headers
        }
        url = self.build_api_url(
                api_path.format(
                    tenant=self.tenant,
                    controllerId=self.controller_id,
                    **kwargs))
        self.logger.debug('PUT {}'.format(url))
        self.logger.debug(json.dumps(data))
        with aiohttp.Timeout(self.timeout):
            async with self.session.put(url, headers=put_headers,
                                        data=json.dumps(data)) as resp:
                await self.check_http_status(resp)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号