deb-zaqar/zaqar/common/request.py
Flavio Percoco 36e63c9a45 Rename Marconi to Zaqar
This patch renames every package, file, match of Marconi in the codebase
to Zaqar *except* for the .gitreview file, which will have to be updated
*after* I8e587af588d9be0b5ebbab4b0f729b106a2ae537 lands.

Implements blueprint: project-rename

Change-Id: I63cf2c680cead4641f3e430af379452058bce5b3
2014-08-04 10:36:50 +02:00

58 lines
1.7 KiB
Python

# Copyright (c) 2013 Rackspace, Inc.
# Copyright (c) 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import json
from zaqar.common import decorators
class Request(object):
"""General data for a Zaqar request
Transport will generate a request object and send to this the API to be
processed.
:param operation: Operation to identify the API call being processed, i.e:
- get_queues
- get_messages
:type operation: str
:param content: Request's body. Default: None
:type content: str
:param params: Query string params. Default: None
:type params: dict
:param headers: Request headers. Default: None
:type headers: dict
:param api: Api entry point. i.e: 'queues.v1'
:type api: `six.text_type`.
"""
def __init__(self, operation='',
content=None, params=None,
headers=None, api=None):
self._api = None
self._api_mod = api
self.operation = operation
self.content = content
self.params = params or {}
self.headers = headers or {}
@decorators.lazy_property()
def deserialized_content(self):
if self.content is not None:
return json.loads(self.content)
return None