base_resource.py 文件源码

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

项目:python-wiremock 作者: platinummonkey 项目源码 文件源码
def _partial_update(cls, entity, parameters=None, ids={}):  # pragma: no cover
        entity_id = getattr(entity, 'id', None)
        if entity_id is not None:
            ids['id'] = entity_id
        if isinstance(entity, BaseAbstractEntity):
            response = cls.REST_CLIENT.patch(
                cls.get_base_uri(cls.endpoint_single(), **ids), json=entity.get_json_data(), headers=make_headers(),
                params=parameters
            )
        else:
            response = cls.REST_CLIENT.patch(
                cls.get_base_uri(cls.endpoint_single(), **ids), data=json.dumps(entity), headers=make_headers(),
                params=parameters
            )

        response = cls.REST_CLIENT.handle_response(response)

        if cls.entity_class() is None or not issubclass(cls.entity_class(), BaseAbstractEntity):
            return response  # pragma: no cover
        else:
            return cls.entity_class().from_dict(response.json())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号