def query_by_string(search_string: str, limit: int = 5) -> dict:
    """query to search wikipedia for pages containing search string.
    options for search found here: https://www.mediawiki.org/wiki/API:Search
    and for query here: https://www.mediawiki.org/wiki/API:Query"""

    if not 0 < limit <= 500:
        raise Exception("Check parameters; limit must be an int between 1 and 500")

    query = {
        "format": "json",
        "generator": "search",
        "gsrsearch": search_string.replace(" ", "+"),
        "gsrlimit": f"{limit}",
        "colimit": f"{limit}",
        "action": "query",
        "prop": "coordinates|pageterms|pageimages",
        "piprop": "original|name",
        "coprop": "type",
        "coprimary": "primary",
    }
    return query