Skip to main content

TBD

Project description

mediawiki-to-pdf

session

MediaWikiSession(access_token: str, apiurl: str) returns a requests.Session subclass that adds Mediawik authorization headers. apiurl is typically https://example.com/api.php MediaWikiSession.parse_yaml(file) is convenience method that reads access token and url from YAML file:

mediawiki:
  url: https://wiki.example.com/api.php
  access token: /usr/local/x/wiki_token

where access token is a file name.

PDF

save_pdf_from_authenticated_session(session: MediaWikiSession, page_title: str, output_path: str)->Path: Fetchs a MediaWiki page via API and convert it to PDF using pdfkit. Returns output. /usr/bin/wkhtmlpdf must be installed.

Command line

Processes list of pages specified in YAML file.

usage: mediawiki_to_pdf [-h] [-l LOGLEVEL] yaml

positional arguments:
  yaml                  Configuration file

options:
  -h, --help            show this help message and exit
  -l LOGLEVEL, --loglevel LOGLEVEL
                        Python logging level (default: WARN)

Example:

---
mediawiki:
  url: https://wiki.example.com/api.php
  access token: /usr/local/x/wiki_token
pages:
  -  First_page 
  -  Second_page 
...

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

mediawiki_to_pdf-1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

mediawiki_to_pdf-1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file mediawiki_to_pdf-1.0.tar.gz.

File metadata

  • Download URL: mediawiki_to_pdf-1.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for mediawiki_to_pdf-1.0.tar.gz
Algorithm Hash digest
SHA256 7b5354df380fda4c686ed9c12d556836e6e76532d629f9d45e7bd44cf55655a2
MD5 49473fe13032c1f15053c880355f3e7d
BLAKE2b-256 f8358108ababfcbeb5eebc84cf9b9544ca2a1866eaac778b7db0e96ce1909006

See more details on using hashes here.

File details

Details for the file mediawiki_to_pdf-1.0-py3-none-any.whl.

File metadata

  • Download URL: mediawiki_to_pdf-1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for mediawiki_to_pdf-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ecbf0a74d421a95627973ec51d3e7fe92093b6ab4569a59a92bab2b68ede0d5
MD5 37d3831ccd9eb0590840b82cd69075d0
BLAKE2b-256 cf25cc4410fb3587871c49bc34caebddce7588dba479da64adbfd77471fc109c

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