Command-line Interface (cli)

This module provides utilities for interacting with a user from the command-line.

mwapi.cli.do_login(session, for_what)[source]

Performs a login handshake with a user on the command-line. This method will handle all of the follow-up requests (e.g. capcha or two-factor). A login that requires two-factor looks like this:

>>> import mwapi.cli
>>> import mwapi
>>> mwapi.cli.do_login(mwapi.Session("https://en.wikipedia.org"), "English Wikipedia")
Log into English Wikipedia
Username: Halfak (WMF)
Passord:
Please enter verification code from your mobile app
Token(OATHToken): 234567
Parameters:
session
: mwapi.Session

A session object to use for login

for_what
: str

A name to display to the use (for what they are logging into)