def build_signature(self, user_api_key, user_secret, request):
        path = request.get_full_path()
        sent_signature = request.META.get(
            self.header_canonical('Authorization'))
        signature_headers = self.get_headers_from_signature(sent_signature)
        unsigned = self.build_dict_to_sign(request, signature_headers)

        # Sign string and compare.
        signer = HeaderSigner(
            key_id=user_api_key, secret=user_secret,
            headers=signature_headers, algorithm=self.ALGORITHM)
        signed = signer.sign(unsigned, method=request.method, path=path)
        return signed['authorization']
Ensure that a stream will be binary safe. See _make_binary_on_windows.
dataset/ETHPy150Open etoccalino/django-rest-framework-httpsignature/rest_framework_httpsignature/authentication.py/SignatureAuthentication.build_signature--crossover with--dataset/ETHPy150Open byt3bl33d3r/pth-toolkit/lib/python2.7/site-packages/samba/external/subunit/__init__.py/_make_stream_binary