mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 22:03:13 -07:00
Add create_url
utility
This commit is contained in:
parent
8d4a1c734c
commit
53c5f267db
1 changed files with 15 additions and 0 deletions
|
@ -1,4 +1,6 @@
|
|||
import os.path
|
||||
import typing
|
||||
import urllib.parse
|
||||
|
||||
import core
|
||||
from core import logger
|
||||
|
@ -109,3 +111,16 @@ def get_dirs(section, subsection, link='hard'):
|
|||
logger.debug('No directories identified in {0}:{1} for post-processing'.format(section, subsection))
|
||||
|
||||
return list(set(to_return))
|
||||
|
||||
|
||||
def create_url(
|
||||
scheme: str,
|
||||
host: str,
|
||||
port: typing.Optional[int],
|
||||
path: str,
|
||||
query: str,
|
||||
) -> str:
|
||||
"""Create a url from its component parts."""
|
||||
netloc = host if port is None else f'{host}:{port}'
|
||||
fragments = ''
|
||||
return urllib.parse.urlunsplit([scheme, netloc, path, query, fragments])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue