def make_request_headers(self, request_uri):
        """Generating specific headers from Mimecast credentials."""
        self.request_id = str(uuid.uuid4())
        hdr_date = datetime.datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S UTC")
        unsigned_auth_header = '{date}:{req_id}:{uri}:{app_key}'.format(
            date=hdr_date,
            req_id=self.request_id,
            uri=request_uri,
            app_key=self.app_key
        )
        hmac_sha1 = hmac.new(
            base64.b64decode(self.secret_key),
            unsigned_auth_header.encode(),
            digestmod=EncryptionAlgo).digest()
        sig = base64.encodebytes(hmac_sha1).rstrip()
        headers = {
            'Authorization': 'MC ' + self.access_key + ':' + sig.decode(),
            'x-mc-app-id': self.app_id,
            'x-mc-date': hdr_date,
            'x-mc-req-id': self.request_id,
            'Content-Type': 'application/json'
        }
        return headers
Generating specific headers from Mimecast credentials.
Solutions/MimecastSEG/Data Connectors/Helpers/request_helper.py