Welcome to the Kelkoo Group Customer Service

Signing URL – Python

In order to access the service, you’ll need first to “sign” your URLs. Here is an example of code :

Variables

Name Type Summary
urlDomain string (required) URL of the service (ex: http://uk.shoppingapis.kelkoo.com)
urlPath string (required) Path and query for the service (ex: /V3/productSearch?query=ipod)
id string (required) Affiliate Id
key string (required) Affiliate secret key

Sample Code

import time
import hashlib
import base64

def signUrl(urlDomain, urlPath, id, key):
	urlTmp = urlPath + "&aid=%s&timestamp=%s" % (id, int(time.time()))
	hash=base64.b64encode(hashlib.md5((urlTmp + key).encode('utf-8')).digest()).decode().replace('+','.').replace('/','_').replace('=','-')
	return urlDomain + urlTmp + "&hash=" + hash;

Simply call the function to generate the appropriate URL:

 signUrl('http://uk.shoppingapis.kelkoo.com', '/V3/productSearch?query=ipod&sort=default_ranking&start=1&results=20&show_products=1&show_subcategories=1&show_refinements=1','myId', 'myKey');