def fetch_and_print_taxon(ws_url='https://ci.kbase.us/services/ws/'): """Fetch Taxon from Workspace Service. Args: ws_url (str): a service address or a local directory containing a downloaded version of the data created with the ``dump_wsfile`` utility. """ # Initialize API with target object taxon_ref = 'ReferenceTaxons/242159_taxon' # Try to connect to remote service taxon = TaxonAPI(token=os.environ.get('KB_AUTH_TOKEN'), ref=taxon_ref, services={'workspace_service_url': ws_url}) # Now the methods of the instance can be used to fetch and show # taxonomic information print('Got taxon "{} ({})"'.format(taxon.get_scientific_name(), taxon.get_taxonomic_id()))
def fetch_and_print_taxon(ws_url='https://ci.kbase.us/services/ws/'): """Fetch Taxon from Workspace Service. Args: ws_url (str): a service address or a local directory containing a downloaded version of the data created with the ``dump_wsfile`` utility. """ # Initialize API with target object taxon_ref = 'ReferenceTaxons/242159_taxon' # Try to connect to remote service taxon = TaxonAPI(token=os.environ.get('KB_AUTH_TOKEN'), ref=taxon_ref, services={'workspace_service_url': ws_url}) # Now the methods of the instance can be used to fetch and show # taxonomic information print('Got taxon "{} ({})"'.format(taxon.get_scientific_name(), taxon.get_taxonomic_id()))
def get_scientific_name(self, token=None, ref=None): taxon_api = TaxonAPI(self.services, token, ref) return taxon_api.get_scientific_name()
def get_scientific_name(self, token=None, ref=None): try: taxon_api = TaxonAPI(self.services, token, ref) return taxon_api.get_scientific_name() except Exception, e: raise ttypes.ServiceException(e.message, traceback.print_exc(), "get_scientific_name", {"ref": str(ref)})