Advice and Commands for Pywikibot
based on https://www.mediawiki.org/wiki/Manual:Pywikibot/Scripts

Logging in
If the bot isn't logged into the wiki with a designated bot user account, run:
python pwb.py login

Throttling a script
For safety's sake and to not overload the wiki, you should limit the rate of your API calls.  Bot scripts will automatically throttle themselves according to the value of "put_throttle" in user-config.py, but if you are performing an operation by calling a bot script multiple times then you must implement your own external throttle.  For working examples, see my Bash scripts.

Running a script
See "Read-me.rtf".

Category renaming
python pwb.py category move -from:"Art by Okita" -to:"Art by Alex Okita"

General text replacement
python pwb.py replace -page:pagetitle "old text" "new text" -summary:"something"
Use "-simulate" to perform a dry-run.
Add "-always" to save edit without prompting.  Not using this will allow a -simulate run to show you what changes will actually be made.  For working examples of how to use "replace", see my Bash scripts.

Batch uploading
python pwb.py upload -keep -noverify -abortonwarn /folder/with/imgs/ "[[Category:Some image cat]]"

Batch renaming (moving)
python pwb.py movepages -noredirect -pairsfile:/full/path/to/name_changes.txt
The .txt file must contain a series of lines like so:
[[frompage1]]
[[topage1]]
[[frompage2]]
[[topage2]]

Page scope arguments
There are a ton of ways to select pages on which to run a Pywikibot script on besides specifying a single page with "-page".  Not only are there -cat and -catr (all pages recursively under that cat), but also -ns, -grep, -subpage, -titleregex, -wantedpages, -transcludes, -start (proceeds from that point alphabetically), -imagesused (on a given page), -links (to other pages from a given page), -filelinks (image links on given page), and much more.  See "Generator and replace options.txt" for details.