Skip to content

mediawiki-utilities/python-mwviews

Folders and files

Image for: Folders and files
NameName
Last commit message
Last commit date

Latest commit

Image for: Latest commit
 

History

Image for: History
38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image for: Repository files navigation

Wikimedia Foundation Pageview Tools

This project is a collection of tools used to parse and query Wikimedia Foundation pageview data, from both static dumps and the online API.

Install

Image for: Install

pip install mwviews

pageview API

Image for: pageview API
from mwviews.api import PageviewsClient

# Sends a descriptive User-Agent header with every request
p = PageviewsClient(user_agent="<person@organization.org> Selfie, Cat, and Dog analysis")

p.article_views('en.wikipedia', ['Selfie', 'Cat', 'Dog'])
p.project_views(['ro.wikipedia', 'de.wikipedia', 'commons.wikimedia'])
p.top_articles('en.wikipedia', limit=10)
p.top_by_country('en.wikipedia', limit=10)
p.top_per_country('in', limit=10)
p.article_views('en.wikipedia', ['Selfie', 'Cat'], granularity='monthly', start='20160201', end='20160331')

# Feel free to add your own features in pull requests!

When querying for multiple articles and multiple projects the client uses ThreadPoolExecutor to parallelize. You can set the level of parallelism when you instantiate the client like p = PageviewsClient(10).

Publishing a new release to PyPi

Image for: Publishing a new release to PyPi

Currently only Dan Andreescu (aka milimetric) is set up as a maintainer on PyPi. If you'd like to share this awesome responsibility, just let him know or create an issue here. The publishing guide we follow is: https://packaging.python.org/en/latest/tutorials/packaging-projects/


About

Image for: About

Tools for parsing and querying Wikimedia Foundation pageview data from both static dumps and the online API.

Resources

License

Stars

Watchers

Forks

Packages

Image for: Packages 0
No packages published

Contributors 6

Image for: Contributors 6

Languages

Image for: Languages