You are not making use of hmac
at all in your code.
Typical way to use hmac
, construct an HMAC object from your key, message and identify the hashing algorithm by passing in its constructor:
h = hmac.new( key, my, hashlib.sha256 )
print( h.hexdigest() )
That should output
adcb671e8e24572464c31e8f9ffc5f638ab302a0b673f72554d3cff96a692740
for your example data.