Example #1
0
 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
Example #2
0
 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
Example #3
0
 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
Example #4
0
 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)