Skip to main content

mw-category-members Build Status PyPI PyPI - Python Version

Using MediaWiki's API: retrieve pages that belong to a given category

Installation

pip install mw_category_members

Usage

import category_members

results = category_members.retrieve('Category:Presidents_of_the_United_States')
for r in results:
    print(r['name'], r['link'])

Arguments

def retrieve(cat_name, mw_instance='https://en.wikipedia.org', types=['page', 'subcat', 'file'], clean_subcat_names=False):
  • cat_name: Category name e.g. 'Category:Presidents_of_the_United_States'.
  • mw_instance: Which MediaWiki instance to use (the URL 'origin'). Defaults to 'https://en.wikipedia.org'.
  • types: Which types of pages to retrieve. Defaults to ['page', 'subcat', 'file'].
  • clean_subcat_names: If True, removes the e.g. 'Category:' prefix of the titles. Defaults to False.

Returns

Array of pages where a page is a dictionary of {'name': 'some name', 'link': 'some absolute link'}.

License

MIT.

Release files for mw-category-members 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mw-category-members 0.1.0
File Size Uploaded
mw_category_members-0.1.0.tar.gz 2.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mw-category-members 0.1.0
File Interpreter ABI Platform
mw_category_members-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 5.3 kB

Release files / mw_category_members-0.1.0.tar.gz

Download URL mw_category_members-0.1.0.tar.gz
Size 2.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8be27a6c20e67fa5c055c68b38214acc8e287391b459f13cd7ecc551950de745
BLAKE2b-256 checksum
How to use checksums
158fae86267dded0ee6c1e7189e8177cafac3aa7890a023a27ff068d3bd8c4f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

Release files / mw_category_members-0.1.0-py3-none-any.whl

Download URL mw_category_members-0.1.0-py3-none-any.whl
Size 3.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d86149066118f856648126538b75e9d6702138fcf790cc73455435c8be0ff0f
BLAKE2b-256 checksum
How to use checksums
dfdb62603c664688398e2aa0a12f6d9848b4d402d2e4a1f33b4752c76f823314
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page