Last modified: 2013-12-29 07:03:18 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T60980, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 58980 - Write Python script to create new wiki user(s)
Write Python script to create new wiki user(s)
Status: RESOLVED FIXED
Product: Wikimedia
Classification: Unclassified
Quality Assurance (Other open bugs)
wmf-deployment
All All
: Unprioritized enhancement (vote)
: ---
Assigned To: Theopolisme
gci2013 https://www.mediawiki.org/wik...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-12-26 21:27 UTC by Jeff Hall
Modified: 2013-12-29 07:03 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Jeff Hall 2013-12-26 21:27:25 UTC
The Mediawiki API provides the ability to create new user accounts[1]

For example, the following two Curl commands issued in sequence will create a new user at a Mediawiki instance running on "localhost":


curl -c cookies.txt -X POST "http://localhost/mediawiki/api.php?action=createaccount&name=Tester&password=test1234&language=en&format=json&token="


curl -b cookies.txt -X POST "http://localhost/mediawiki/api.php?action=createaccount&name=Tester&password=test1234&language=en&format=json&token=<token provided in response to previous request>"


As a proof-of-concept, create a Python script that will do the same thing, with two special functions:

1) The URL of the Mediawiki instance should be created from the value of an environment variable called "API_URL" (for example, using Python's "os.getenv" method).

2) The account name and password should be randomly generated alphanumeric strings, each with a length of 8 characters.



[1] http://www.mediawiki.org/wiki/API:Account_creation
Comment 1 Sam Reed (reedy) 2013-12-26 22:13:15 UTC
Why?
Comment 2 Theopolisme 2013-12-27 07:48:59 UTC
Script is available at https://gist.github.com/theopolisme/8143834 :)

Like Sam, I am curious as to what this is going to be used for, though.

Thanks!
Comment 3 Jeff Hall 2013-12-27 16:17:35 UTC
Thanks Theopoliosme!  This was actually intended as a task for Google Code-in students, but I guess you beat them to the punch!
Comment 4 Theopolisme 2013-12-27 17:14:40 UTC
You're very welcome. I actually *am* a GCI participant, interestingly enough :)
Comment 5 Jeff Hall 2013-12-27 17:50:46 UTC
OK, I didn't realize you were a GCI participant Theopoliosme - thanks for working on this task!  I ran into a minor error when running the script locally, and added that comment to the GCI task:

http://www.google-melange.com/gci/task/view/google/gci2013/5788241391255552

In reference to the questions about WHY we want this script, it's to complement an existing Python script used to generated new wiki articles, and the scripts in tandem will eventually be used for running automated browser tests against new releases, with the goal that each test is "hermetic" and can run against a fresh Mediawiki install without assuming the presence of certain user accounts and articles (the test should create whatever user logins and article content it needs).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links