serializer.py 文件源码

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

项目:ws-backend-community 作者: lavalamp- 项目源码 文件源码
def decode(self, o):
        """
        Decode the contents of the given JSON dictionary as an object used by Web Sight.
        :param o: The JSON dictionary to process.
        :return: The contents of the given JSON dictionary deserialized into an object.
        """
        from lib.arin.response import BaseArinResponse
        from ..geolocation import IpGeolocation
        if "__class_type" not in o:
            raise UnsupportedDeserializationError("No class type specified in JSON dictionary: %s" % o)
        class_type = o["__class_type"]
        deserialization_class = get_class_from_import_string(class_type)
        if deserialization_class == PreparedRequest:
            return self.__deserialize_requests_prepared_request(o)
        elif deserialization_class == Response:
            return self.__deserialize_requests_response(o)
        elif issubclass(deserialization_class, BaseArinResponse):
            return self.__deserialize_arin_response(o)
        elif deserialization_class == IpGeolocation:
            return self.__deserialize_ip_geolocation(o)
        else:
            raise UnsupportedDeserializationError(
                "Class %s does not have a deserialization method."
                % deserialization_class
            )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号