From charlesreid1

Revision as of 21:31, 31 January 2018 by Admin (talk | contribs) (Created page with "=Setup= ==Install== Start by installing pywikibot. Recommended method is: * git checkout the pywikibot repo * python setup.py build * python setup.py install See Pywikibo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Setup

Install

Start by installing pywikibot. Recommended method is:

  • git checkout the pywikibot repo
  • python setup.py build
  • python setup.py install

See Pywikibot.

Configure Site

To configure which site you want pywikibot to use, run the provided login script through the pwb.py script. From the pywikibot directory, run:

python3 pwb.py login

This will prompt you for a site URL, username, and password.

(Where do the credentials get stored???)

Once you log in, there will be a user-config.py file created. Copy this to whichever directory you wish to run pywikibot from.

This user-config.py file does not contain any sensitive information.

Write/Run Scripts

Once you have your user config file in your working directory, you can start your script like this:

import pywikibot
s = pywikibot.Site()

This will create a Site object corresponding to whichever site you have specified in your user-config.py file.