def safe_url_string(url, encoding='utf8'):
    s = unicode_to_str(url, encoding)
    return moves.urllib.parse.quote(s, _safe_chars)
Convert the given url into a legal URL by escaping unsafe characters
dataset/ETHPy150Open scrapinghub/frontera/frontera/utils/url.py/safe_url_string