import hmac, base64, hashlib, urllib2 base = \'https://.......\' def makereq(key, secret, path, data): hash_data = path + chr(0) + data secret = base64.b64d
You are redefining the hmac variable within the function scope, so the global variable from the import statement isn't present within the function scope. Renaming the function-scope hmac variable should fix your problem.
hmac
import