def get_hostname_prefix():
  """Returns the hostname prefix of a running Endpoints service.

  The prefix is the portion of the hostname that comes before the API name.
  For example, if a non-default version and a non-default service are in use,
  the returned result would be '{VERSION}-dot-{SERVICE}-'.

  Returns:
    str, the hostname prefix.
  """
  parts = []

  # Check if this is the default version
  version = modules.get_current_version_name()
  default_version = modules.get_default_version()
  if version != default_version:
    parts.append(version)

  # Check if this is the default module
  module = modules.get_current_module_name()
  if module != 'default':
    parts.append(module)

  # If there is anything to prepend, add an extra blank entry for the trailing
  # -dot-
  if parts:
    parts.append('')

  return '-dot-'.join(parts)
def get_hostname_prefix ( ) : parts = [ ] version = modules . get_current_version_name ( ) default_version = modules . get_default_version ( ) if version != default_version : parts . append ( version ) module = modules . get_current_module_name ( ) if module != 'default' : parts . append ( module ) if parts : parts . append ( '' ) return '-dot-' . join ( parts )
Returns the hostname prefix of a running Endpoints service.

  The prefix is the portion of the hostname that comes before the API name.
  For example, if a non-default version and a non-default service are in use,
  the returned result would be '{VERSION}-dot-{SERVICE}-'.

  Returns:
    str, the hostname prefix.