auth.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:edd 作者: JBEI 项目源码 文件源码
def _build_message(self, request):
        """
        Builds a string representation of the message contained in the request so it can be
        digested for HMAC generation
        """
        url = urlparse(request.url)

        # THe version 1 spec of the HmacSignature class calls for the message to be signed
        #   formatted as the following elements, each separated by a newline character:
        #   * UserId (same value as used in Authorization header)
        #   * HTTP Method (e.g. GET, POST)
        #   * HTTP Host (e.g. server.example.org)
        #   * Request path (e.g. /path/to/resource/)
        #   * SORTED query string, keyed by natural UTF8 byte-ordering of names
        #   * Request Body
        delimiter = '\n'
        msg = delimiter.join((
            self._USERNAME or '',
            request.method,
            url.netloc,
            url.path,
            self._sort_parameters(url.query),
            request.body or '',
        ))
        return msg
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号