def __init__(self, method, path='/', data={}, headers=cidict({'content-type': 'application/json', 'accept': 'application/json'})): self.method = method self.path = path if 'content-type' in headers and headers['content-type'] == 'application/json': self.data = json.dumps(data) self.headers = headers
def __init__(self, method, path="/", data={}, headers=cidict({"content-type": "application/json"}), params={}): self.method = method self.path = path if "content-type" in headers and headers["content-type"] == "application/json": self.data = json.dumps(data) else: self.data = data self.headers = headers self.params = params
def __init__(self, method, path='/', data={}, headers=cidict({'content-type': 'application/json'}), params={}): self.method = method self.path = path if 'content-type' in headers and headers[ 'content-type'] == 'application/json': self.data = json.dumps(data) else: self.data = data self.headers = headers self.params = params
def request(self, method, path='', data={}, params={}, headers=cidict({'content-type': 'application/json'})): return Request(method, data=data, path=path_join(self.path, self.id, path), params=params, headers=headers)