Manual:Pywikibot/PAWS

This document provides a quick interactive overview of Pywikibot using a 'notebook' hosted on the Wikimedia Foundation labs environment using 'PAWS' (Pywikibot: A Web Shell).

Create a Wikimedia account
To follow this walk-through, you only need an account on a Wikimedia project.

To create a Wikimedia account, see Help:Logging in. (Avoid special characters until T120066 is fixed.)

Once you have created an account, please visit https://test.wikipedia.org/ (this works around T120327).

Sign into a notebook
To start a hosted notebook, go to https://tools.wmflabs.org/paws

Click "Sign in with MediaWiki", and then click "Allow" when asked to approve "Use OAuth for Authentication".

The first time you access PAWS, you need to create a server.

Once that is completed, you will be redirected to a URL like https://tools.wmflabs.org/paws/user/ /tree

Start a terminal
To start a new interactive terminal,
 * 1) click 'New' on the right hand side, and
 * 2) select 'Terminal'.

This will open a new window with the URL https://tools.wmflabs.org/paws/user/ /terminals/1, with a Linux '$' prompt.

You can bookmark this URL, and return to the terminal at any time, even after you have closed your browser or shutdown your own computer.

This terminal is not an emulator. It is a real bash shell, as part of a real Linux installation sitting on a virtual machine, so you can use any bash command, and use any commands available on Linux that have been installed.

To see some of the commands available, use ls.

Login to the wiki
Pywikibot needs a configuration file 'user-config.py' which PAWS automatically creates for you, with https://test.wikipedia.org/ as the default wiki.

The following command should confirm that you can log into https://test.wikipedia.org/. It will prompt for your password. After typing your password, press Enter, and it will then attempt to login and confirm it was successful.

Create a page
To create a page, enter the following command in the terminal, replacing ' ' with your username, and pressing 'Y' when prompted to accept your changes:

You have edited the wiki. View your changes by opening https://test.wikipedia.org/wiki/User_talk: in your web browser.

You can read more about these command line scripts with the '-help' command line option.

Fetch a page
Fetching many pages is achieved with the "listpages" command.

To get the contents of the page you created in the previous section, enter the following command:

Now if you go to your PAWS files list, the saved page should be present.