(self, key, msg=None, digestmod='')
Create a new HMAC object.

        key: bytes or buffer, key for the keyed hash object.
        msg: bytes or buffer, Initial input for the hash or None.
        digestmod: A hash name suitable for hashlib.new(). *OR*
                   A hashlib constructor returning a new hash object. *OR*
                   A module supporting PEP 247.

                   Required as of 3.8, despite its position after the optional
                   msg argument.  Passing it as a keyword argument is
                   recommended, though not required for legacy API reasons.
Create a new HMAC object.
Create a new HMAC object .
def __init__(self, key, msg=None, digestmod=''):
        """Create a new HMAC object.

        key: bytes or buffer, key for the keyed hash object.
        msg: bytes or buffer, Initial input for the hash or None.
        digestmod: A hash name suitable for hashlib.new(). *OR*
                   A hashlib constructor returning a new hash object. *OR*
                   A module supporting PEP 247.

                   Required as of 3.8, despite its position after the optional
                   msg argument.  Passing it as a keyword argument is
                   recommended, though not required for legacy API reasons.
        """

        if not isinstance(key, (bytes, bytearray)):
            raise TypeError("key: expected bytes or bytearray, but got %r" % type(key).__name__)

        if not digestmod:
            raise TypeError("Missing required parameter 'digestmod'.")

        if _hashopenssl and isinstance(digestmod, (str, _functype)):
            try:
                self._init_hmac(key, msg, digestmod)
            except _hashopenssl.UnsupportedDigestmodError:
                self._init_old(key, msg, digestmod)
        else:
            self._init_old(key, msg, digestmod)
def __init__ ( self , key , msg = None , digestmod = '' ) : if not isinstance ( key , ( bytes , bytearray ) ) : raise TypeError ( "key: expected bytes or bytearray, but got %r" % type ( key ) . __name__ ) if not digestmod : raise TypeError ( "Missing required parameter 'digestmod'." ) if _hashopenssl and isinstance ( digestmod , ( str , _functype ) ) : try : self . _init_hmac ( key , msg , digestmod ) except _hashopenssl . UnsupportedDigestmodError : self . _init_old ( key , msg , digestmod ) else : self . _init_old ( key , msg , digestmod )