import pywikibot
import os
from pathlib import Path
import shutil
PYWIKIBOT_SCRIPTS_DIR = Path('/srv/paws/pwb/scripts')
LOCAL_SCRIPTS_DIR = Path.home() / 'scripts'
help(pywikibot.Page.save)
Help on function save in module pywikibot.page: save(self, summary=None, watch=None, minor=True, botflag=None, force=False, asynchronous=False, callback=None, apply_cosmetic_changes=None, quiet=False, **kwargs, comment='[deprecated name of summary]', sysop=NotImplemented, async='[deprecated name of asynchronous]') Save the current contents of page's text to the wiki. @param summary: The edit summary for the modification (optional, but most wikis strongly encourage its use) @type summary: str @param watch: Specify how the watchlist is affected by this edit, set to one of "watch", "unwatch", "preferences", "nochange": * watch: add the page to the watchlist * unwatch: remove the page from the watchlist * preferences: use the preference settings (Default) * nochange: don't change the watchlist If None (default), follow bot account's default settings For backward compatibility watch parameter may also be boolean: if True, add or if False, remove this Page to/from bot user's watchlist. @type watch: str, bool (deprecated) or None @param minor: if True, mark this edit as minor @type minor: bool @param botflag: if True, mark this edit as made by a bot (default: True if user has bot status, False if not) @param force: if True, ignore botMayEdit() setting @type force: bool @param asynchronous: if True, launch a separate thread to save asynchronously @param callback: a callable object that will be called after the page put operation. This object must take two arguments: (1) a Page object, and (2) an exception instance, which will be None if the page was saved successfully. The callback is intended for use by bots that need to keep track of which saves were successful. @param apply_cosmetic_changes: Overwrites the cosmetic_changes configuration value to this value unless it's None. @type apply_cosmetic_changes: bool or None @param quiet: enable/disable successful save operation message; defaults to False. In asynchronous mode, if True, it is up to the calling bot to manage the output e.g. via callback. @type quiet: bool
os.listdir(PYWIKIBOT_SCRIPTS_DIR)
['casechecker.py', 'table2wiki.py', 'archive', 'interwiki.py', 'add_text.py', 'catall.py', 'commons_link.py', 'imageharvest.py', 'reflinks.py', 'surnames_redirects.py', 'touch.py', 'welcome.py', 'shell.py', 'solve_disambiguation.py', 'djvutext.py', 'coordinate_import.py', 'unusedfiles.py', 'template.py', 'piper.py', 'category_redirect.py', 'listpages.py', 'watchlist.py', 'nowcommons.py', 'imageuncat.py', 'userscripts', 'category.py', 'archivebot.py', 'script_wui.py', 'movepages.py', 'patrol.py', 'commonscat.py', 'disambredir.py', 'redirect.py', 'upload.py', 'fixing_redirects.py', 'harvest_template.py', 'imagetransfer.py', 'illustrate_wikidata.py', 'cfd.py', 'login.py', 'imagecopy.py', 'basic.py', 'templatecount.py', 'capitalize_redirects.py', 'version.py', 'revertbot.py', 'i18n', 'replicate_wiki.py', 'spamremove.py', 'misspelling.py', 'README.rst', 'imagerecat.py', 'claimit.py', 'protect.py', 'blockpageschecker.py', 'followlive.py', 'wikisourcetext.py', 'delete.py', 'maintenance', 'flickrripper.py', 'unlink.py', 'imagecopy_self.py', 'image.py', 'cosmetic_changes.py', 'editarticle.py', 'isbn.py', 'states_redirect.py', 'newitem.py', 'replace.py', 'match_images.py', 'interwikidata.py', 'transferbot.py', 'noreferences.py', 'ndashredir.py', 'clean_sandbox.py', 'data_ingestion.py', 'makecat.py', 'weblinkchecker.py', 'checkimages.py', '__init__.py', 'lonelypages.py', 'selflink.py', 'freebasemappingupload.py', 'standardize_interwiki.py', 'pagefromfile.py', 'create_categories.py', '__pycache__']
filename = 'newitem.py'
shutil.copyfile(PYWIKIBOT_SCRIPTS_DIR / filename, LOCAL_SCRIPTS_DIR / filename)
PosixPath('/home/paws/scripts/newitem.py')
filename = 'claimit.py'
shutil.copyfile(PYWIKIBOT_SCRIPTS_DIR / filename, LOCAL_SCRIPTS_DIR / filename)
PosixPath('/home/paws/scripts/claimit.py')
filename = 'data_ingestion.py'
shutil.copyfile(PYWIKIBOT_SCRIPTS_DIR / filename, LOCAL_SCRIPTS_DIR / filename)
PosixPath('/home/paws/scripts/data_ingestion.py')
filename = 'table2wiki.py'
shutil.copyfile(PYWIKIBOT_SCRIPTS_DIR / filename, LOCAL_SCRIPTS_DIR / filename)
PosixPath('/home/paws/scripts/table2wiki.py')