Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get(self, resource, query_id=None, options=None):
"""Queries the REST service and returns the result"""
response = get(host=self._configuration.host,
port=self._configuration.port,
version=self._configuration.version,
species=self._configuration.species,
category=self._category,
subcategory=self._subcategory,
query_id=query_id,
resource=resource,
options=options)
return response
def _get(self, resource, query_id=None, options=None):
"""Queries the REST service and returns the result"""
response = get(session=self._session,
host=self._configuration.host,
version=self._configuration.version,
species=self._configuration.species,
category=self._category,
subcategory=self._subcategory,
query_id=query_id,
resource=resource,
options=options)
return response
def ping(self, **options):
"""Checks if service is alive"""
# This particular REST endpoint follows the structure
# /{version}/meta/ping
response = get(session=self._session,
host=self._configuration.host,
version=self._configuration.version,
species=None,
category=self._category,
subcategory=None,
resource='ping',
options=options)
return response
def _post(self, resource, query_id=None, options=None, data=None):
"""Queries the REST service and returns the result"""
response = get(session=self._session,
host=self._configuration.host,
version=self._configuration.version,
species=self._configuration.species,
category=self._category,
subcategory=self._subcategory,
query_id=query_id,
resource=resource,
options=options,
method='post',
data=data)
return response
def get_species(self, **options):
"""Returns available species"""
# This particular REST endpoint follows the structure
# /{version}/meta/species
response = get(session=self._session,
host=self._configuration.host,
version=self._configuration.version,
species=None,
category=self._category,
subcategory=None,
resource='species',
options=options)
return response
def get_feature_class(self, **options):
"""Returns list of available regulatory feature classes"""
# This particular REST endpoint follows the structure
# /{version}/{species}/regulatory/featureClass
response = get(session=self._session,
host=self._configuration.host,
version=self._configuration.version,
species=self._configuration.species,
category=self._category,
subcategory=None,
resource='featureClass',
options=options)
return response
def get_info(self, **options):
"""Returns general information"""
# This particular REST endpoint follows the structure
# /{version}/{species}/info
response = get(session=self._session,
host=self._configuration.host,
version=self._configuration.version,
species=self._configuration.species,
category=None,
subcategory=None,
resource='info',
options=options)
return response
def get_versions(self, **options):
# This particular REST endpoint follows the structure
# /{version}/meta/{species}/versions
"""Returns source version metadata, including source urls"""
response = get(session=self._session,
host=self._configuration.host,
version=self._configuration.version,
species=None,
category=self._category,
subcategory=self._configuration.species,
resource='versions',
options=options)
return response
def get_category(self, query_id, **options):
# This particular REST endpoint follows the structure
# /{version}/meta/{category}
"""Returns source version metadata, including source urls"""
categories = ['feature', 'genomic', 'network', 'regulatory']
if query_id not in categories:
msg = 'Query has to be one of the following: ' + str(categories)
raise ValueError(msg)
response = get(session=self._session,
host=self._configuration.host,
version=self._configuration.version,
species=None,
category=self._category,
subcategory=None,
resource=query_id,
options=options)
return response
def get_feature_type(self, **options):
"""Returns list of available regulatory feature types"""
# This particular REST endpoint follows the structure
# /{version}/{species}/regulatory/featureType
response = get(session=self._session,
host=self._configuration.host,
version=self._configuration.version,
species=self._configuration.species,
category=self._category,
subcategory=None,
resource='featureType',
options=options)
return response