def make_request(self, extra_data, method="GET", **kwargs):
        """
        Return dict wrapper from raw request.

        :param extra_data:
        :param method:
        :param kwargs:
        :return:
        """
        response = self.request(extra_data, method, **kwargs)
        try:
            parsed_response = DictWrapper(response.content, extra_data.get("Action") + "Result")
        except XMLError:
            parsed_response = DataWrapper(response.content, response.headers)

        # Store the response object in the parsed_response for quick access
        parsed_response.response = response
        return parsed_response
Example #2
0
def test_content_md5_comparison():
    data = b'abc\tdef'
    hash = 'Zj+Bh1BJ8HzBb9ToK28qFQ=='
    DataWrapper(data, {'content-md5': hash})
Example #3
0
def test_content_md5_check_raises_exception_if_fails():
    data = b'abc\tdef'
    hash = 'notthehash'
    with pytest.raises(MWSError):
        DataWrapper(data, {'content-md5': hash})
def test_content_md5_comparison():
    data = b"abc\tdef"
    hash = "Zj+Bh1BJ8HzBb9ToK28qFQ=="
    DataWrapper(data, {"content-md5": hash})
def test_content_md5_check_raises_exception_if_fails():
    data = b"abc\tdef"
    hash = "notthehash"
    with pytest.raises(MWSError):
        DataWrapper(data, {"content-md5": hash})