Example #1
0
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()))
Example #2
0
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()))
Example #3
0
 def get_taxonomic_id(self, token=None, ref=None):
     taxon_api = TaxonAPI(self.services, token, ref)
     return taxon_api.get_taxonomic_id()
Example #4
0
 def get_taxonomic_id(self, token=None, ref=None):
     try:
         taxon_api = TaxonAPI(self.services, token, ref)
         return taxon_api.get_taxonomic_id()
     except Exception, e:
         raise ttypes.ServiceException(e.message, traceback.print_exc(), "get_taxonomic_id", {"ref": str(ref)})