Skip to main content

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

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mw_category_members-0.1.0.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mw_category_members-0.1.0-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file mw_category_members-0.1.0.tar.gz.

File metadata

  • Download URL: mw_category_members-0.1.0.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for mw_category_members-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8be27a6c20e67fa5c055c68b38214acc8e287391b459f13cd7ecc551950de745
MD5 1d36eda6c81c95f0979182c552a0c5ba
BLAKE2b-256 158fae86267dded0ee6c1e7189e8177cafac3aa7890a023a27ff068d3bd8c4f4

See more details on using hashes here.

File details

Details for the file mw_category_members-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mw_category_members-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for mw_category_members-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d86149066118f856648126538b75e9d6702138fcf790cc73455435c8be0ff0f
MD5 bb151c23b96994d8fcd5326b05dc55e0
BLAKE2b-256 dfdb62603c664688398e2aa0a12f6d9848b4d402d2e4a1f33b4752c76f823314

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page