MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / get_base_host

Method get_base_host

apps/proxy/hls_proxy/server.py:395–413  ·  view source on GitHub ↗

Extract base host from URL. Args: url: Full URL to parse Returns: str: Base host in format 'scheme://hostname' Example: 'http://example.com/path' -> 'http://example.com'

(self, url: str)

Source from the content-addressed store, hash-verified

393 self.redirect_cache.clear()
394
395 def get_base_host(self, url: str) -> str:
396 """
397 Extract base host from URL.
398
399 Args:
400 url: Full URL to parse
401
402 Returns:
403 str: Base host in format 'scheme://hostname'
404
405 Example:
406 'http://example.com/path' -> 'http://example.com'
407 """
408 try:
409 parsed = urlparse(url)
410 return f"{parsed.scheme}://{parsed.netloc}"
411 except Exception as e:
412 logging.error(f"Error extracting base host: {e}")
413 return url
414
415 def download(self, url: str) -> tuple[bytes, str]:
416 """

Callers 1

downloadMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected