How to use the werobot.utils.json_loads function in WeRoBot

To help you get started, we’ve selected a few WeRoBot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github offu / WeRoBot / werobot / session / postgresqlstorage.py View on Github external
def get(self, id):
        """
        根据 id 获取数据。

        :param id: 要获取的数据的 id
        :return: 返回取到的数据,如果是空则返回一个空的 ``dict`` 对象
        """
        cur = self.conn.cursor()
        cur.execute("SELECT value FROM WeRoBot WHERE id=%s LIMIT 1;", (id, ))
        session_json = cur.fetchone()
        if session_json is None:
            return {}
        return json_loads(session_json[0])
github JoneXiong / oejia_wx / ext_libs / werobot / session / mongodbstorage.py View on Github external
def get(self, id):
        document = self._get_document(id)
        if document:
            session_json = document["session"]
            return json_loads(session_json)
        return {}
github offu / WeRoBot / werobot / session / redisstorage.py View on Github external
def get(self, id):
        """
        根据 id 获取数据。

        :param id: 要获取的数据的 id
        :return: 返回取到的数据,如果是空则返回一个空的 ``dict`` 对象
        """
        id = self.key_name(id)
        session_json = self.redis.get(id) or '{}'
        return json_loads(session_json)
github JoneXiong / oejia_wx / ext_libs / werobot / session / filestorage.py View on Github external
def get(self, id):
        session_json = self.db.get(id, "{}")
        return json_loads(session_json)
github liangliangyy / DjangoBlog / servermanager / MemcacheStorage.py View on Github external
def get(self, id):
        id = self.key_name(id)
        session_json = self.cache.get(id) or '{}'
        return json_loads(session_json)
github offu / WeRoBot / werobot / session / mongodbstorage.py View on Github external
def get(self, id):
        """
        根据 id 获取数据。

        :param id: 要获取的数据的 id
        :return: 返回取到的数据,如果是空则返回一个空的 ``dict`` 对象
        """
        document = self._get_document(id)
        if document:
            session_json = document["session"]
            return json_loads(session_json)
        return {}
github offu / WeRoBot / werobot / session / filestorage.py View on Github external
def get(self, id):
        """
        根据 id 获取数据。

        :param id: 要获取的数据的 id
        :return: 返回取到的数据,如果是空则返回一个空的 ``dict`` 对象
        """
        try:
            session_json = self.db[id]
        except KeyError:
            session_json = "{}"
        return json_loads(session_json)
github JoneXiong / oejia_wx / ext_libs / werobot / session / redisstorage.py View on Github external
def get(self, id):
        id = self.key_name(id)
        session_json = self.redis.get(id) or '{}'
        return json_loads(session_json)