File size: 254 Bytes
7fcdb70
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
def strip_url_query(url):
    return url.split("?", 1)[0]


def get_trimmed_url(url, max_len):
    trimmed_url = strip_url_query(url)
    if len(trimmed_url) > max_len:
        trimmed_url = trimmed_url[:max_len] + " ..."
    return trimmed_url