def append_query_parameter ( url , parameters , ignore_if_exists = True ) : if ignore_if_exists : for key in parameters . keys ( ) : if key + "=" in url : del parameters [ key ] parameters_str = "&" . join ( k + "=" + v for k , v in parameters . items ( ) ) append_token = "&" if "?" in url else "?" return url + append_token + parameters_str
how to add a ? in python url
quick and dirty appending of query parameters to a url
def append_query_parameter(url, parameters, ignore_if_exists=True):
    """ quick and dirty appending of query parameters to a url """
    if ignore_if_exists:
        for key in parameters.keys():
            if key + "=" in url:
                del parameters[key]
    parameters_str = "&".join(k + "=" + v for k, v in parameters.items())
    append_token = "&" if "?" in url else "?"
    return url + append_token + parameters_str