[Mailman-Users] Python remote urllib.request -> mailman subscription
kip at thevertigo.com
Fri May 17 10:50:49 CEST 2013
I'm not sure if anyone has done this before (probably), but I figured
I'd run my solution by those more knowledgeable of the inner workings of
My Python 3 / PyGI / Gtk+ application, among other things, prompts a
user for their name, email, and password, and then submits an http POST
request to a hard coded remote GNU Mailman server. So far, the code
appears to work and I'll request a peer review by anyone kind enough:
One potential concern I've found is that it is difficult to machine
parse the server response to reliably distinguish a successful
subscription from a failure. A successful subscription returns an http
code 200, but so do many failed ones (e.g. bad formatted email address
is still code 200).
The most reliable brute force method I could come up with was to check
the message body of the returned HTML document for the substring "Your
subscription request has been received". Great, except since Mailman is
i18n capable, its gettext could return something semantically
equivalent, but obviously worded different if the locale is changed.
However, since the server I am submitting the request to will probably
always use the English user interface, this probably won't be an issue,
but is still inelegant and I'd like to solve it. Moreover, even if it
remains in English, but perhaps the string changes anyways when Mailman
is upgraded, then it is a problem again.
Does anyone have any suggestions or other feedback they'd like to share
or propose a better solution?
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 198 bytes
Desc: This is a digitally signed message part
More information about the Mailman-Users