Manual:Pywikibot/Instal·lació

This page is a translated version of the page Manual:Pywikibot/Installation and the translation is 60% complete.
Outdated translations are marked like this.
Aquesta pàgina t'ajudarà a començar amb Pywikibot, ja sigui en el teu ordinador, a Toolforge o usant PAWS: A Web Shell.
On PAWS

PAWS: A Web Shell (PAWS com a Servei Web) és la manera més senzilla de començar amb Pywikibot. No fa falta cap instal·lació, i es fa servir una interfície web per enviar les comandes.

Al teu ordinador

A continuació es mostra un manual per ajudar-vos a configurar Pywikibot i funcionar al vostre propi ordinador. Hi ha quatre passos principals en aquest procés:

Toolforge us proporciona una infraestructura estable núvol als servidors Wikimedia que us permet executar bots contínuament o segons una programació.

Instal·lar Python

Descarrega i instal·la Python des dehttps://www.python.org/downloads/.

Si ja tens Python instal·lat, comprova que la teva versió és prou recent executant la comanda python --version en un terminal. To discover if Python version 3 or above is installed, run python3 --version in a console.

Ubuntu 19.04 and up comes with versions 2 & 3 installed. Python v2 runs by default using terminal command python; to use v3, use terminal command python3.

Python 3.7 or higher is currently required to run the bot.

On Windows please do not forget to modify PATH environment variable to make Python and pip work properly.

Install dependencies

Additional packages are required to run Pywikibot. Run the following command to install these packages:

$ python -m pip install "requests>=2.20.1"
$ python -m pip install "mwparserfromhell>=0.5.2"
$ python -m pip install packaging

For Python 3.7 an additional package is required. Install it with:

$ python -m pip install importlib_metadata

An alternate MediaWiki markup parser may be installed with:

$ python -m pip install "wikitextparser>=0.47.5"

See also https://doc.wikimedia.org/pywikibot/stable/introduction.html#quick-start

Instal·leu Pywikibot

$ python -m pip install pywikibot

If using pip, use pwb instead of python pwb.py in examples below.

Descarregueu la branca actual de Pywikibot stable: .tar.gz, .zip.

Descomprimeix aquest arxiu, per exemple a ~/pywikibot o a %USERPROFILE%\pywikibot.

Alternatively, you may retrieve the latest version using git or svn client from Gerrit, see Manual:Pywikibot/Gerrit#For users . This is the recommended way for active bot operators and developers to use Pywikibot.

Altres versions estan disponibles a https://pywikibot.toolforge.org/.

Actualitzar Pywikibot

Mantingueu actualitzat el vostre framework de bot. Les noves versions es publiquen contínuament i estan disponibles al mateix lloc.

Si feu servir git o svn release, podeu ometre aquesta nota. En cas contrari, tingueu en compte la necessitat de fer una còpia de seguretat dels fitxers de configuració i dels scripts (user-config.py, qualsevol fitxer familiar o script personalitzat que pugueu haver creat o canviat i qualsevol fitxer de buidatge XML actual que utilitzeu per a una wiki) abans d’instal·lar una nova versió.

Després descomprimeix la nova versió sobre la vella de manera que la sobreescriguis.

Configurar Pywikibot

Open Terminal on Unix-like (Linux/BSD/Solaris) or Command Prompt on Windows (typically under Windows System or Accessories folders in All apps or All programs menu inside the Start menu), and change directory to where you unpacked Pywikibot:

Unix-like (Linux/BSD/Solaris):
$ cd ~/core
Windows:
$ c:
$ cd "%USERPROFILE%\pywikibot"

Naturalment has de substituir la ubicació d'exemple per la ubicació on has descomprimit pywikibot.

Continue with the following command to generate user configuration file:

$ python pwb.py generate_user_files

Segueix les indicacions per configurar el pywikibot.

Finally run the following command to log in to your wiki:

$ python pwb.py login

Ús en wikis de tercers

El Pywikibot està configurat per a un gran nombre de wikis, però possiblement no per a aquella en què tu vols treballar. Mira Manual:Pywikibot/Use on third-party wikis per saber com configurar el Pywikibot per a la teva wiki.

Més opcions de configuració

El Pywikibot proporciona un gran nombre d'opcions de configuració per a canviar el comportament del teu bot. Pots canviar aquests ajustos en el fitxer 'user-config.py'. Mira config.py per veure una llista dels paràmetres que pots usar.

Proxy configuration

Pywikibot relies on requests for communicating with the web. You can use HTTP_PROXY and HTTPS_PROXY environment variables to make requests use a proxy server. Refer to requests' documentation for more info.

Executar un script

El Pywikibot incorpora dins l'arxiu comprimit un gran nombre de scripts en la carpeta "scripts". Pots executar-los fent servir

$ python pwb.py [name of the script]

To learn more about running basic Pywikibot scripts, see:

A $scripts trobaràs una llista de tots els scripts disponibles.

Other dependencies

La majoria dels scripts no requereixen paquets addicionals, però alguns no funcionaran sense. Aquests es mostren en requirements.txt juntament amb les seves dependències.

Per instal·lar dependències d'algun script, utilitzeu pip i executeu l'ordre següent:

$ python -m pip install [name of the package]

Com a alternativa, executeu l'ordre següent per instal·lar totes les dependències de tots els scripts alhora:

$ python -m pip install -r requirements.txt


If you need more help on setting up your Pywikibot visit the #pywikibot IRC channel connect or pywikibot@ mailing list.