diff options
| author | 2025-12-08 20:23:39 +0100 | |
|---|---|---|
| committer | 2025-12-08 20:23:39 +0100 | |
| commit | d9cc5bc118249b1d1db894145e158290f5bd7dcd (patch) | |
| tree | fab968a0f32ad83665ba1daa565d30e97b71730f | |
| parent | user-config: fallback to '' to be able to run w/out auth (diff) | |
| signature | ||
mwrepl: update to work with pywikibot
| -rw-r--r-- | config.py | 46 | ||||
| -rwxr-xr-x | mwrepl.py | 11 |
2 files changed, 3 insertions, 54 deletions
diff --git a/config.py b/config.py deleted file mode 100644 index 88b07e7..0000000 --- a/config.py +++ /dev/null @@ -1,46 +0,0 @@ -import importlib, sys - -# default config file, copy the contents into local_config.py and modify -if __name__ == "local_config": - config = importlib.reload(sys.modules["config"]).config -else: - - class config: # dummy, so the local config can simply be a copy of this template - ... - - -class config(config): - class self: - name = "KleaBot" - source = "http://git.hollyhock.internal/u/klea/archiveteam" - gitdir = "./" - - class mediawikiAuth: - import os - login = False - username = "" - password = "" - if 'ATWIKIBOT_USERNAME' in os.environ and 'ATWIKIBOT_PASSWORD' in os.environ: - login = True - username = os.environ['ATWIKIBOT_USERNAME'] - password = os.environ['ATWIKIBOT_PASSWORD'] - - class admin: - ... - - class cmd: - ... - -# you can remove the following lines if you're editing local_config.py -if __name__ == "config": - try: - config = importlib.reload(sys.modules["local_config"]).config - except ModuleNotFoundError: - ... - #print("\x1b[31m!!! you should probably set up local config !!!\x1b[0m") - except KeyError: - try: - from local_config import config - except ModuleNotFoundError: - ... - #print("\x1b[31m!!! you should probably set up local config !!!\x1b[0m") @@ -1,18 +1,13 @@ #!/usr/bin/env python3 import collections -import mwclient +import pywikibot import re -from config import * -site = mwclient.Site('wiki.archiveteam.org', path = '/', clients_useragent="User:KleaBot (trunk)") -if config.mediawikiAuth.login: - site.login(config.mediawikiAuth.username, config.mediawikiAuth.password) +site = pywikibot.Site() if __name__ == '__main__': import os os.environ['PYTHONINSPECT'] = 'TRUE' if os.environ['PAGER'] == 'less.sh': os.environ['PAGER'] = 'less' - print("You've got access to a mwclient as site") - if config.mediawikiAuth.login: - print("Logged in to the AT wiki as", config.mediawikiAuth.username) + print("You've got access to a pywikibot client as site") |
