def __call__(self, req):
        """sign the request"""
        req = self.set_more_headers(req)
        signature = self.get_signature(req)

        if self._expires is None:
            # auth with headers
            req.headers["authorization"] = "OSS {0}:{1}".format(
                self._access_key, signature
            )
        else:
            # auth with url
            oss_url = url.URL(req.url)
            oss_url.append_params(dict(
                Expires=self._expires,
                OSSAccessKeyId=self._access_key,
                Signature=signature
            ))
            req.url = oss_url.forge(key=lambda x: x[0])
        return req
def __call__ ( self , req ) : req = self . set_more_headers ( req ) signature = self . get_signature ( req ) if self . _expires is None : req . headers [ "authorization" ] = "OSS {0}:{1}" . format ( self . _access_key , signature ) else : oss_url = url . URL ( req . url ) oss_url . append_params ( dict ( Expires = self . _expires , OSSAccessKeyId = self . _access_key , Signature = signature ) ) req . url = oss_url . forge ( key = lambda x : x [ 0 ] ) return req
sign the request