Beispiel #1
0
 def join(url, other):
     # if the other URL is an absolute url, then return that
     if urlparse(other).scheme:
         return other
     elif url:
         parts = list(urlsplit(url))
         if not parts[2].endswith("/"):
             parts[2] += "/"
         url = urlunsplit(parts)
         return urljoin(url, other)
     else:
         return other
 def join(url, other):
     # if the other URL is an absolute url, then return that
     if urlparse(other).scheme:
         return other
     elif url:
         parts = list(urlsplit(url))
         if not parts[2].endswith("/"):
             parts[2] += "/"
         url = urlunsplit(parts)
         return urljoin(url, other)
     else:
         return other
Beispiel #3
0
def copy_query_url(to, from_):
    """
    Replace the query string in one URL with the query string from another URL
    """
    return urlunsplit(urlsplit(to)._replace(query=urlsplit(from_).query))