Jump to content

Pywikipediabot: Difference between revisions

From IdeaWazaWiki
wikademia>Millosh
New page: '''Pywikipediabot''' is the "Python Wikipediabot Framework is a set of bot scripts to do things on Wikipedia or other wikis using MediaWiki. It has b...
 
wikademia>Millosh
No edit summary
Line 1: Line 1:
'''[[meta:Using the python wikipediabot|Pywikipediabot]]''' is the "Python Wikipediabot Framework is a set of bot scripts to do things on Wikipedia or other wikis using MediaWiki. It has been written by several people using the language Python. On this page, we give the general information for people who want to use the bot software."
'''[[meta:Using the python wikipediabot|Pywikipediabot]]''' (PWB) is the "Python Wikipediabot Framework is a set of bot scripts to do things on Wikipedia or other wikis using MediaWiki. It has been written by several people using the language Python. On this page, we give the general information for people who want to use the bot software."


== Needed skills ==
== Needed skills ==
Line 13: Line 13:


[[meta:Using the python wikipediabot|Documentation on Pywikipediabot page]] is very good. Use it for initial instructions.
[[meta:Using the python wikipediabot|Documentation on Pywikipediabot page]] is very good. Use it for initial instructions.
== Some general basics ==
Your bot should assume that it is multilingual. Because of that, use [[w:UTF-8|UTF-8]] (or some better character set) and declare it at the beginning of your Python script:
<source lang="python">
#!/usr/bin/python
# -*- coding: utf-8 -*-
</source>


== Pywikipediabot basics ==
== Pywikipediabot basics ==
=== Importing basic modules ===
Usually, [[User:Millosh|I am]] using this approach in calling basic PWB functions:
<source lang="python">
mydir = "./"
pwbdir = mydir + "pywikipedia/"
import sys
sys.path.append(pwbdir)
from wikipedia import *
</source>


[[Category:Python]]
[[Category:Python]]
[[Category:MediaWiki]]
[[Category:MediaWiki]]
[[Category:Computer programming]]
[[Category:Computer programming]]

Revision as of 16:46, 23 December 2007

Pywikipediabot (PWB) is the "Python Wikipediabot Framework is a set of bot scripts to do things on Wikipedia or other wikis using MediaWiki. It has been written by several people using the language Python. On this page, we give the general information for people who want to use the bot software."

Needed skills

This course assumes that you know/have:

  • Installed Python on your operating system
  • Using necessary tools
  • Python basics
  • Introduction into Wikimedia projects

Installing pywikipediabot framework

Documentation on Pywikipediabot page is very good. Use it for initial instructions.

Some general basics

Your bot should assume that it is multilingual. Because of that, use UTF-8 (or some better character set) and declare it at the beginning of your Python script:

<source lang="python">

  1. !/usr/bin/python
  2. -*- coding: utf-8 -*-

</source>

Pywikipediabot basics

Importing basic modules

Usually, I am using this approach in calling basic PWB functions:

<source lang="python"> mydir = "./" pwbdir = mydir + "pywikipedia/" import sys sys.path.append(pwbdir) from wikipedia import * </source>