zaqar.common.api.request.Request

Here are the examples of the python api zaqar.common.api.request.Request taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

Example 1

Project: zaqar Source File: handler.py
Function: create_request
    @staticmethod
    def create_request(payload=None, env=None):
        if payload is None:
            payload = {}
        action = payload.get('action')
        body = payload.get('body', {})
        headers = payload.get('headers')

        return request.Request(action=action, body=body,
                               headers=headers, api="v2", env=env)

Example 2

Project: zaqar Source File: test_request.py
Function: test_request
    def test_request(self):
        action = consts.MESSAGE_POST
        data = 'body'
        env = {'foo': 'bar'}
        req = request.Request(action=action, body=data, env=env)
        self.assertEqual({'foo': 'bar'}, req._env)
        self.assertEqual('body', req._body)
        self.assertEqual(consts.MESSAGE_POST, req._action)