34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
import os
|
|
import time
|
|
import hmac, hashlib
|
|
|
|
|
|
class VendorConfig(object):
|
|
|
|
datetime = ''
|
|
#replace with your own accesskey
|
|
accesskey = "****"
|
|
#replace with your own secretKey
|
|
secretkey = "****"
|
|
vendorid = ''
|
|
|
|
def __init__(self):
|
|
super(VendorConfig, self).__init__();
|
|
|
|
os.environ['TZ'] = 'GMT+0'
|
|
|
|
self.datetime=time.strftime('%y%m%d')+'T'+time.strftime('%H%M%S')+'Z'
|
|
method = "DELETE"
|
|
path = "/v2/providers/seller_api/apis/api/v1/marketplace/seller-products/83358541"
|
|
|
|
message = datetime+method+path
|
|
|
|
|
|
|
|
#********************************************************#
|
|
#authorize, demonstrate how to generate hmac signature here
|
|
signature=hmac.new(secretkey.encode('utf-8'),message.encode('utf-8'),hashlib.sha256).hexdigest()
|
|
authorization = "CEA algorithm=HmacSHA256, access-key="+accesskey+", signed-date="+datetime+", signature="+signature
|
|
#print out the hmac key
|
|
#print(authorization)
|
|
#********************************************************# |