def get_query(string, pos=1):
    """Get query parameter of a URL."""
    try:
        return string.split("?")[pos]
    except IndexError:
        if pos == 1:
            return ""
        else:
            return string