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

Keys in data structure returned by article_views should match the title strings passed in #19

Open
colinmorris opened this issue Mar 2, 2022 · 1 comment

Comments

@colinmorris
Copy link

Example:

>>> p.article_views('en.wikipedia', ['Bug report'], granularity='monthly', start='20220101', end='20220228')
defaultdict(<class 'dict'>, {datetime.datetime(2022, 1, 1, 0, 0): {'Bug_report': 262}, datetime.datetime(2022, 2, 1, 0, 0): {'Bug_report': 266}})

It's somewhat confusing that I can't use the titles I passed to the function ('Bug report') to index the data I get back. Instead I need to reverse-engineer the munging the applied by the mwviews client.

@milimetric
Copy link
Contributor

The API returns data likes this: https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia/all-access/user/Cat/daily/2022020900/2022030100

So you're welcome to send a PR to implement a different output format. This is just what other people wanted out of this client, but as you can see it's not what comes back from the API, so you have flexibility.

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

2 participants