Пример #1
0
    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())
Пример #2
0
    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
Пример #3
0
    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()
Пример #4
0
    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()
Пример #5
0
 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())
Пример #6
0
    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()
Пример #7
0
    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()
Пример #8
0
    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()
Пример #9
0
    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()
Пример #10
0
 def delete(self,data):
     return requests.delete(url=make_url(self.url,data)).json()
Пример #11
0
 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())
Пример #12
0
 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())
Пример #13
0
 def delete(self, data):
     return requests.delete(url=make_url(self.url, data)).json()
Пример #14
0
    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)
Пример #15
0
 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())
Пример #16
0
    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