예제 #1
0
 def get(self, resource_path, query_params=None, headers=None):
     url = self._version_url(resource_path)
     result = self.app.get(urllib.quote(url),
                           headers=headers,
                           query_string=build_query_string(query_params))
     result.json = json.loads(result.data)
     return result
예제 #2
0
 def put(self, resource_path, data=None, query_params=None):
     url = self._version_url(resource_path)
     result = self.app.put(urllib.quote(url),
                           content_type='application/json',
                           data=json.dumps(data) if data else None,
                           query_string=build_query_string(query_params))
     result.json = json.loads(result.data)
     return result
예제 #3
0
 def put_file(self, resource_path, file_path, query_params=None):
     url = self._version_url(resource_path)
     with open(file_path) as f:
         result = self.app.put(urllib.quote(url),
                               data=f.read(),
                               query_string=build_query_string(
                                   query_params))
         result.json = json.loads(result.data)
         return result