예제 #1
0
 def get_packages_by_filename(self, ds, filename):
     id = self._get_id(ds)
     resp = self._get(
         self._uri("/{id}/packages?filename={filename}",
                   id=id,
                   filename=filename))
     return [
         DataPackage.from_dict(p, api=self.session)
         for p in resp.get("packages")
     ]
예제 #2
0
 def files(self, dataset, concept, instance):
     """
     Return list of files (i.e. packages) related to record.
     """
     dataset_id  = self._get_id(dataset)
     concept_id  = self._get_id(concept)
     instance_id = self._get_id(instance)
     resp = self._get(
         self._uri('/{dataset_id}/concepts/{concept_id}/instances/{instance_id}/files',
             dataset_id=dataset_id, 
             concept_id=concept_id,
             instance_id=instance_id
         ))
     return [DataPackage.from_dict(pkg, api=self.session) for r,pkg in resp]