code: def guess_endpoint_uri(rq, gh_repo):
      
      auth = (static.DEFAULT_ENDPOINT_USER, static.DEFAULT_ENDPOINT_PASSWORD)
      if auth == ('none', 'none'):
          auth = None
  
      if has_request_context() and "endpoint" in request.args:
          endpoint = request.args['endpoint']
          glogger.info("Endpoint provided in request: " + endpoint)
          return endpoint, auth
  
      # Decorator
      try:
          decorators = get_yaml_decorators(rq)
          endpoint = decorators['endpoint']
          auth = None
          glogger.info("Decorator guessed endpoint: " + endpoint)
      except (TypeError, KeyError):
          # File
          try:
              endpoint_content = gh_repo.getTextFor({'download_url': 'endpoint.txt'})
              endpoint = endpoint_content.strip().splitlines()[0]
              auth = None
              glogger.info("File guessed endpoint: " + endpoint)
          # TODO: except all is really ugly
          except:
              # Default
              endpoint = static.DEFAULT_ENDPOINT
              auth = (static.DEFAULT_ENDPOINT_USER, static.DEFAULT_ENDPOINT_PASSWORD)
              if auth == ('none', 'none'):
                  auth = None
              glogger.warning("No endpoint specified, using default ({})".format(endpoint))
  
      return endpoint, auth
docs: Guesses the endpoint URI from (in this order):
      - An endpoint parameter in URL
      - An #+endpoint decorator
      - A endpoint.txt file in the repo
      Otherwise assigns a default one