async def delete(self, data, bulk=False): url = make_url(self.url, data, bulk) with aiohttp.ClientSession() as session: async with session.delete(url) as response: resp = await response.read() return json.loads(resp.decode())
def update(self,data): compat_object = data["body"] return requests.post(url=make_url(self.url,data),data=json.dumps(compat_object)).json() return requests
def get(self, data): """ takes in data having a type and id to get the data from appbase :param data: :return: """ return requests.get(url=make_url(self.url,data)).json()
def get(self, data): """ takes in data having a type and id to get the data from appbase :param data: :return: """ return requests.get(url=make_url(self.url, data)).json()
async def update(self, data): compat_object = data["body"] url = make_url(self.url, data) + "/_update" with aiohttp.ClientSession() as session: async with session.post( url, data=json.dumps(compat_object)) as response: resp = await response.read() return json.loads(resp.decode())
def update(self,data): """ takes in data and stores it in appbase. the data should have a body key :param data: :return: """ compat_object = data["body"] return requests.post(url=make_url(self.url,data)+"/_update",data=json.dumps(compat_object)).json()
def index(self,data,bulk=False): """ takes in data and stores it in appbase. the data should have a body key :param data: :return: """ compat_object = data["body"] return requests.post(url=make_url(self.url,data,bulk),data=json.dumps(compat_object)).json()
def update(self, data): """ takes in data and stores it in appbase. the data should have a body key :param data: :return: """ compat_object = data["body"] return requests.post(url=make_url(self.url, data) + "/_update", data=json.dumps(compat_object)).json()
def index(self, data, bulk=False): """ takes in data and stores it in appbase. the data should have a body key :param data: :return: """ compat_object = data["body"] return requests.post(url=make_url(self.url, data, bulk), data=json.dumps(compat_object)).json()
def delete(self,data): return requests.delete(url=make_url(self.url,data)).json()
async def delete(self,data): with aiohttp.ClientSession() as session: async with session.delete(make_url(self.url,data)) as response: resp = await response.read() return json.loads(resp.decode())
async def update(self,data): compat_object = data["body"] with aiohttp.ClientSession() as session: async with session.post(make_url(self.url,data),data=json.dumps(compat_object)) as response: resp = await response.read() return json.loads(resp.decode())
def delete(self, data): return requests.delete(url=make_url(self.url, data)).json()
async def get_stream(self, data, callback): url = make_url(self.url, data) url = url + "?stream=true" return await self._stream_on_url(url, data, callback)
async def get(self, data): with aiohttp.ClientSession() as session: async with session.get(make_url(self.url, data)) as response: resp = await response.read() return json.loads(resp.decode())
def get_stream(self,data,callback=None): url = make_url(self.url,data)+"?stream=true" # direct concatenation as the url isn't going to be used by the user if callback: pass