mirror of
https://github.com/wahyd4/youxiang.git
synced 2026-08-09 05:16:08 +10:00
fix pdd_api file
This commit is contained in:
@@ -4,6 +4,7 @@ import time
|
||||
|
||||
PDD_API_ROOT = 'https://gw-api.pinduoduo.com/api/router'
|
||||
|
||||
|
||||
class PddApiClient(object):
|
||||
def __init__(self, app_key, secret_key):
|
||||
self.app_key = app_key
|
||||
@@ -11,7 +12,8 @@ class PddApiClient(object):
|
||||
|
||||
def get_sign(self, params):
|
||||
params_list = sorted(list(params.items()), key=lambda x: x[0])
|
||||
params_bytes = (self.secret_key + ''.join("%s%s" % (k, v) for k, v in params_list) + self.secret_key).encode('utf-8')
|
||||
params_bytes = (self.secret_key + ''.join("%s%s" % (k, v) for k, v in params_list) + self.secret_key).encode(
|
||||
'utf-8')
|
||||
sign = hashlib.md5(params_bytes).hexdigest().upper()
|
||||
return sign
|
||||
|
||||
@@ -29,7 +31,8 @@ class PddApiClient(object):
|
||||
resp = requests.get(PDD_API_ROOT, params=params, **kwargs)
|
||||
print(resp.url)
|
||||
return resp
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
||||
# pdd = PddApiClient(app_key='', secret_key='')
|
||||
Reference in New Issue
Block a user