Ejemplo n.º 1
0
    def query(self, terms, max_results=10):
        data = dict(query=terms, maxResults=max_results)
        resp = self._post(endpoint='', data=data)

        results = []
        for r in resp:
            pkg_cls = get_package_class(r)
            pkg = pkg_cls.from_dict(r, api=self.session)
            results.append(pkg)

        return results
Ejemplo n.º 2
0
    def query(self, terms, max_results=10):
        data = dict(query=terms, maxResults=max_results)
        resp = self._post(endpoint='', json=data)

        results = []
        for r in resp:
            pkg_cls = get_package_class(r)
            if pkg_cls == Dataset:
                pkg = self.session.datasets.get(r['id'])
            else:
                pkg = self.session.packages.get(r['id'])

            results.append(pkg)

        return results
Ejemplo n.º 3
0
    def _get_package_from_data(self, data):
        # parse json
        cls = get_package_class(data)
        pkg = cls.from_dict(data, api=self.session)

        return pkg