How to use the werobot.utils.json_dumps 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 set(self, id, value):
        """
        根据 id 写入数据。

        :param id: 要写入的 id
        :param value: 要写入的数据,可以是一个 ``dict`` 对象
        """
        value = json_dumps(value)
        self.conn.cursor().execute(
            "INSERT INTO WeRoBot (id, value) values (%s, %s) ON CONFLICT (id) DO UPDATE SET value = %s;",
            (
                id,
                value,
                value,
            )
        )
        self.conn.commit()
github JoneXiong / oejia_wx / ext_libs / werobot / session / filestorage.py View on Github external
def set(self, id, value):
        self.db[id] = json_dumps(value)
github liangliangyy / DjangoBlog / servermanager / MemcacheStorage.py View on Github external
def set(self, id, value):
        id = self.key_name(id)
        self.cache.set(id, json_dumps(value))
github JoneXiong / oejia_wx / ext_libs / werobot / session / mongodbstorage.py View on Github external
def set(self, id, value):
        document = self._get_document(id)
        session = json_dumps(value)
        if document:
            document["session"] = session
            self.collection.save(document)
        else:
            self.collection.insert({
                "wechat_id": id,
                "session": session
            })
github JoneXiong / oejia_wx / ext_libs / werobot / session / redisstorage.py View on Github external
def set(self, id, value):
        id = self.key_name(id)
        self.redis.set(id, json_dumps(value))
github offu / WeRoBot / werobot / session / mongodbstorage.py View on Github external
def set(self, id, value):
        """
        根据 id 写入数据。

        :param id: 要写入的 id
        :param value: 要写入的数据,可以是一个 ``dict`` 对象
                """
        session = json_dumps(value)
        self.collection.replace_one(
            {"wechat_id": id}, {
                "wechat_id": id,
                "session": session
            },
            upsert=True
        )
github offu / WeRoBot / werobot / session / filestorage.py View on Github external
def set(self, id, value):
        """
        根据 id 写入数据。

        :param id: 要写入的 id
        :param value: 要写入的数据,可以是一个 ``dict`` 对象
        """
        self.db[id] = json_dumps(value)
github offu / WeRoBot / werobot / session / redisstorage.py View on Github external
def set(self, id, value):
        """
        根据 id 写入数据。

        :param id: 要写入的 id
        :param value: 要写入的数据,可以是一个 ``dict`` 对象
        """
        id = self.key_name(id)
        self.redis.set(id, json_dumps(value))