Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request will not follow continue. #77

Open
huascarfiorletta opened this issue Nov 21, 2024 · 0 comments
Open

request will not follow continue. #77

huascarfiorletta opened this issue Nov 21, 2024 · 0 comments

Comments

@huascarfiorletta
Copy link

huascarfiorletta commented Nov 21, 2024

Based on wikimedia page https://www.mediawiki.org/wiki/API:Continue :
"Very often you will not get all the data you want in one API query. When this happens, the API will append an additional element (titled continue) to the results to indicate there is more data."

The current implementation does not fetch such additional data. E.g. pageviews field will be incomplete for the following request without multiple continue calls to the API:

search_params = {
        "action": "query",
        "generator": "geosearch",
        "ggsradius": 10000,
        "ggscoord": "{0}|{1}".format(NYC[0], NYC[1]),
        "ggssort": "relevance",
        "prop": "pageviews",
        "ggslimit": 50,
    }


    raw_results = mwa.session.request(search_params, mwa.config)
    print(json.dumps(raw_results, indent=4))

The solution is to extend requestsession.py as follows:

https://github.com/huascarfiorletta/MediaWikiAPI/blob/master/mediawikiapi/requestsession.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant