Manuale:Pywikibot/Compatto/Uso base

Jump to: navigation, search
This page is a translated version of the page Manual:Pywikibot/Compat/Basic use and the translation is 40% complete.

Other languages:
български • ‎Ελληνικά • ‎English • ‎español • ‎français • ‎italiano • ‎日本語 • ‎polski • ‎русский • ‎српски / srpski • ‎svenska


Guarda Creare un collegamento for Windows users

Seleziona e avvia il bot script[edit]

Ora che hai installato python e Pywikibot, devi avere un'interfaccia testuale al tuo sistema operativo.

Accedi a Pywikibot

Dopo aver creato il file, chiamato user-config.pyManual:Pywikibot/, è possibile accedere a pywikibot.

Su "Windows" questo avviene aprendo il manu start e facendo clic su 'Esegui'. Viene richiesto di indicare il nome di un programma, e scrivere "cmd.exe".

  • Cambia il root in C: scrivendo chdir C:\
  • Scrivere chdir\"nome della cartella dove pswikibot è installato" (Per esempio: chdir\"pywikibot" se il file è nella cartella C:)

Potrebbe essere necessario fare le seguenti operazioni:

  • Sposta la cartella httplib2 che è nella sub-cartella externals di un livello su.
  • Tutti gli script che vuoi usare devono essere copiati dalla cartella "scripts" alla cartella principale. Incluso

Su "Mac", trova in /Applications/Utilities, vedi Mac Installation.

Su "Linux" o qualsiasi altra "Unix", utilizzare qualsiasi applicazione terminale come gnome-terminal, konsole, xterm o semplicemente la console di testo.

In compat, esegui lo script login.pyManual:Pywikibot/ scrivendo "python". Se non hai ancora, questo comando lo creerà.

In core, dalla cartella principale, esegui lo script login.pyManual:Pywikibot/ Se non hai ancora, questo comando lo creerà.

Nota Nota: does add the core directory to the `PATH` variable so that python sees the pywikibot directory. There are other ways to fix this like adding the core directory (or any directory containing the pywikibot directory) to `PATH` or `PYTHONPATH`.

Entering password

Python will then return:

Password for user your_bot on your_site:en:

Use the password you used for the bot's login name. Note that your input will not be visible for privacy reasons. The bot can't work anonymously. Unless you change your password, you normally need to run this program only once, the bot usually does not get logged off.

Using a bot

The bots are in the main pywikibot folder when downloaded.

If necessary, use the command cd to go to the directory where the bot files are saved.

Now run any of the bots here by typing "python" (If you are using Windows, you can leave out "python").


Main page: Manual:Pywikibot/ScriptsManual:Pywikibot/Scripts

Command-line arguments[edit]

Although many bot scripts have their own command line arguments, which should be documented on their respective pages (or in their source code), all bots unless specifically stated to the contrary recognize the following command line arguments:

(full list here: Manual:Pywikibot/Global OptionsManual:Pywikibot/Global Options)

Print a list of global bot arguments (this list), followed by bot-specific help if available.
Set the language of the wiki you want to work on to language code xx, overriding the configuration in
Set the family of the wiki you want to work on, e.g., wikipedia, wiktionary, wikitravel, ... This will override the configuration in
Log in as user 'xyz' instead of the default username.
Enable the logfile. Logs will be stored in the logs subdirectory.
Enable the logfile, using xyz as the filename.
Disable the logfile (if it's enabled by default).
Set the minimum time (in seconds) the bot will wait between saving pages. The default value is 10.

For example, python -family:wiktionary will run the "scriptname" bot on wiktionary articles, overriding the default family setting in your user configuration.

Permission on Wikimedia projects[edit]

Make sure that your bot is approved by the wiki community where you are going to use it: see the global Bot policy for guidance. Strictness differs greatly between various projects.

Using your normal browser, create a login name and password for the bot. It is best to use a name that makes clear that it is a bot, and preferably also who is operating it. A common method is to use your own login name and add the word 'bot' to it, but several other forms also exist.