Editing a wiki

K

KillSwitch

Hey guys,
Is it possible to edit a wiki page with python, including logging in
to edit the page, and inserting text into the edit box, etc. I was
thinking maybe python would be the language to do this in, because I
have to iterate through every line in a text file and gather info
about what to enter in the wiki that way, then put that text in a wiki
page. It's sort of a program-documenting program. If it's possible to
do this, I would make a special way of entering comments in the source
files, like maybe --[[##title code here]] and then --[[@@code example
here]] with the two symbols at the beginning of the comment dictating
what to enter where. Thanks for any input.
 
D

Diez B. Roggisch

KillSwitch said:
Hey guys,
Is it possible to edit a wiki page with python, including logging in
to edit the page, and inserting text into the edit box, etc. I was
thinking maybe python would be the language to do this in, because I
have to iterate through every line in a text file and gather info
about what to enter in the wiki that way, then put that text in a wiki
page. It's sort of a program-documenting program. If it's possible to
do this, I would make a special way of entering comments in the source
files, like maybe --[[##title code here]] and then --[[@@code example
here]] with the two symbols at the beginning of the comment dictating
what to enter where. Thanks for any input.

Take a look at mechanize, which is a python web-client impostor thingy -
it should be easy to use for this purpose.


Diez
 
P

Paul Boddie

Hey guys,
Is it possible to edit a wiki page with python, including logging in
to edit the page, and inserting text into the edit box, etc. I was
thinking maybe python would be the language to do this in, because I
have to iterate through every line in a text file and gather info
about what to enter in the wiki that way, then put that text in a wiki
page.

What you seem to want is a way of interacting with Web forms, and
there are various Python client libraries which do this:

http://wiki.python.org/moin/WebClientProgramming

However, see below.
It's sort of a program-documenting program. If it's possible to
do this, I would make a special way of entering comments in the source
files, like maybe --[[##title code here]] and then --[[@@code example
here]] with the two symbols at the beginning of the comment dictating
what to enter where. Thanks for any input.

Generally, you have to be careful interacting with Web sites in an
automated fashion: Wiki sites in particular often have measures in
place to deter "robots" and behaviour which looks like spamming. If
the Wiki is under your control, you'd be better off uploading content
via the data store (such as the filesystem for MoinMoin and some other
Wiki solutions) or via specific mechanisms provided for administration
of the Wiki.

Paul
 
P

Paul Rubin

KillSwitch said:
Is it possible to edit a wiki page with python, including logging in
to edit the page, and inserting text into the edit box, etc.

If you are talking about MediaWiki (the software behind Wikipedia),
it already has an API for which there are several Python clients.
See:

http://www.mediawiki.org/wiki/API
http://www.mediawiki.org/wiki/API:Client_Code

If you are looking to use Python (or any other language) to
automatically edit Wikipedia itself, you need approval for that.
See:

http://en.wikipedia.org/wiki/Wikipedia:Bot_policy
 
Y

yaka

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top