code: def build_api_url(host=REMOTES['default']['ip'],
                    port=REMOTES['default']['port'],
                    path=REMOTES['default']['path'],
                    username=None,
                    password=None,
                    ssl=False):
      
      credentials = make_http_credentials(username, password)
      scheme = 'http'
      if not path:
          path = ''
      if path and not path.startswith('/'):
          path = "/%s" % path
      if ssl:
          scheme += 's'
      return "%s://%s%s:%i%s" % (scheme, credentials, host, port, path)
docs: Build API URL from components.