Exemplo n.º 1
0
 def get_authorization(http, request_method, timestamp):
     config = ReadConfig()
     token = config.get_headers("token")
     timestampstr = "timestamp=" + timestamp + ";"
     if token == '':
         oauth2Str = "oauth2=" + MD5Util.md5s(timestamp) + ";"
     else:
         oauth2Str = "oauth2=" + token + ";"
     signatureStr = "signature=" + HeadConfig.create_signature(http, timestamp,
                                                               request_method) + ";"
     if token == '':
         secret = "secret=" + MD5Util.md5s(timestamp) + ";"
     else:
         secret = ""
     once = "once=" + MD5Util.md5s(config.get_headers("client_key")) + timestamp + ";"
     developkey = "developkey=" + config.get_headers("develop_key")
     return timestampstr + oauth2Str + signatureStr + secret + once + developkey
Exemplo n.º 2
0
    def create_signature(confighttp, timestamp, request_method):

        content = HeadConfig.get_requestParams(confighttp, request_method)
        # type:ConfigHttp
        request_url = "request_url=" + confighttp.path + "&"
        contentstr = "content=" + content + "&"
        request_method = "request_method=" + request_method + "&"
        timestampstr = "timestamp=" + timestamp + "&"
        config = ReadConfig()
        secret = config.get_headers("secret")
        if secret == '':
            secret = "secret=" + MD5Util.md5s(timestamp)
        else:
            secret = "secret=" + secret
        timestampstr_secret = request_url + contentstr + request_method + timestampstr + secret
        return MD5Util.md5s(timestampstr_secret)