Example #1
0
 def query(self,
           top=None,
           skip=None,
           select=None,
           odata_filter=None,
           expand=None):
     _url_top = make_url_part('top', top, int)
     _url_skip = make_url_part('skip', skip, int)
     _url_select = make_url_part('select', select, str)
     _url_filter = make_url_part('filter', odata_filter, str)
     _url_expand = make_url_part('expand', expand, str)
     url = self.url + _url_top + _url_skip + _url_select + _url_filter + _url_expand
     r = requests.get(url,
                      auth=self.infobase._auth,
                      headers=self.infobase._headers)
     if (r.status_code != 200):
         raise Exception(r.text)
     return json.loads(r.text)['value']
Example #2
0
 def get(self, guid, select=None):
     obj = "Document_{}(guid'{}')".format(self.docname, guid)
     url = self.infobase._full_url.format(obj=obj)
     _url_select = make_url_part('select', select, str)
     url = url + _url_select
     r = requests.get(url,
                      auth=self.infobase._auth,
                      headers=self.infobase._headers)
     if (r.status_code != 200):
         raise Exception(r.text)
     return json.loads(r.text)
Example #3
0
    def slice_last(self,
                   period=None,
                   condition=None,
                   select=None,
                   orderby=None,
                   expand=None):
        _url_select = make_url_part('select', select, str)
        _url_orderby = make_url_part('orderby', orderby, str)
        _url_expand = make_url_part('expand', expand, str)
        period_value = '' if period is None else period
        condition_value = '' if condition is None else condition

        full_url = (self.infobase._full_url.format(
            obj='InformationRegister_' + self.regname +
            f'/SliceLast({period_value},{condition_value})')
                    ) + f'{_url_select}{_url_orderby}{_url_expand}'

        r = requests.get(full_url,
                         auth=self.infobase._auth,
                         headers=self.infobase._headers)
        if (r.status_code != 200):
            raise Exception(r.text)
        return json.loads(r.text)['value']