simplified url qualifier

This commit is contained in:
2018-08-29 22:27:26 +01:00
parent 2b812da26a
commit 453331d69d

View File

@@ -3,6 +3,8 @@
Utilities to provide various misc functions. Utilities to provide various misc functions.
''' '''
from urllib.parse import urljoin
class UrlPoolManager(object): class UrlPoolManager(object):
''' '''
Object to manage the lifecycle of a pool of URLs. Object to manage the lifecycle of a pool of URLs.
@@ -41,21 +43,16 @@ def clean_base_url(url):
# to HTTPS via a 301 redirect. # to HTTPS via a 301 redirect.
base_url = "".join([protocol, url]) base_url = "".join([protocol, url])
# strip the trailing slash to allow us to append
# relative URLs.
if base_url.endswith('/'):
base_url = base_url[:-1]
return base_url return base_url
# def get_url_validation(base_url=None, url=None): def get_url_validation(base_url=None, url=None):
# ''' '''
# Checks if a URL is valid. Can be absolute or relative. Ensure any URLs discovered are absolute. If relative,
# ''' they will be appended to the base URL.
'''
# if url.startswith('/'): if url.startswith('/'):
# full_url = '{0}{1}'.format(base_url, url) return urljoin(base_url, url)
# if url.startswith(ffbase_url): if url.startswith(base_url):
# full_url = url return url
# elif url.startswith('/'):