コード例 #1
0
ファイル: test_case.py プロジェクト: luoyangfeima/karlooper
def test_encrypt():
    str_encryption = StrEncryption()
    str_encryption.input_key("test")
    _str = "make a test"
    encode_str = str_encryption.encode(_str)
    decode_str = str_encryption.decode(encode_str)
    if _str != decode_str:
        print(encode_str)
        print(decode_str)
        print(_str)
        assert "encode string error"
コード例 #2
0
ファイル: request.py プロジェクト: MoiraJune/karlooper
    def set_security_cookie(self, key, value, expires_days=1, path="/", domain=None):
        """set security cookie's value

        :param key: cookie's key
        :param value: cookie's value
        :param expires_days: cookie's expires days
        :param path: cookie's value path
        :param domain: cookie's domain
        :return: None

        """
        des = StrEncryption()
        security_key = self.__settings.get("cookie", COOKIE_SECURITY_DEFAULT_STRING)
        des.input_key(security_key)
        security_value = des.encode(value)
        self.set_cookie(key, security_value, expires_days, path, domain)
コード例 #3
0
ファイル: request.py プロジェクト: karldoenitz/karlooper
    def set_security_cookie(self, key, value, expires_days=1, path="/", domain=None):
        """set security cookie's value

        :param key: cookie's key
        :param value: cookie's value
        :param expires_days: cookie's expires days
        :param path: cookie's value path
        :param domain: cookie's domain
        :return: None

        """
        des = StrEncryption()
        security_key = self.__settings.get("cookie", COOKIE_SECURITY_DEFAULT_STRING)
        des.input_key(security_key)
        security_value = des.encode(value)
        self.set_cookie(key, security_value, expires_days, path, domain)