forked from stove/dataset
27 lines
732 B
Python
27 lines
732 B
Python
def calc_web_address(domain_name: str,
|
|
port: str,
|
|
local_location: str,
|
|
http: bool,
|
|
) -> str:
|
|
if not domain_name or not port:
|
|
return
|
|
if http:
|
|
web_address = f'http://{domain_name}'
|
|
test_port = '80'
|
|
else:
|
|
web_address = f'https://{domain_name}'
|
|
test_port = '443'
|
|
if port != test_port:
|
|
web_address += f':{port}'
|
|
if local_location:
|
|
web_address += local_location
|
|
return web_address
|
|
|
|
|
|
def get_first_value(lst: list):
|
|
if lst:
|
|
if isinstance(lst[0], list):
|
|
if lst[0] and lst[0][0]:
|
|
return lst[0][0]
|
|
else:
|
|
return lst[0]
|