[Mailman-Users] Subscribe/unsubscribe with CGI script?
mark at msapiro.net
Tue May 14 00:49:25 CEST 2013
On 05/13/2013 04:39 AM, Tom Browder wrote:
> I viewed the page source of a typical subscription page to find how it
> normally works.
> I get to the point of subscription and, using modules LWB::UserAgent
> and URI::Esacpe do;
> my $browser = LWP::UserAgent->new;
> # may need to url encode the e-mail
> my $enc_email = uri_escape($email);
> my $enc_name = uri_escape($fullname);
> my $response = $browser->post(
> email => $enc_email,
> fullname => $enc_name,
> When using real data I get the following response from Mailman
> listname Subscription results
> You must supply a valid email address.
I assume $oper is 'subscribe'. There is apparently some incompatibility
between the way perl supplies the post data and the way Python's
cgi.FieldStorage() retrieves it as it is either not seeing the 'email'
name or its value is empty. Those are the only things that produce the
"You must supply a valid email address." response.
You could install the following as a CGI script somewhere and use your
perl module to post to it andsee what it gets.
for n,v in os.environ.items():
print '%s: %s<br>' % (n,v)
print '%r' % cgi.FieldStorage(keep_blank_values=1)
print 'Content-type: text/html'
print '<HTML><HEAD><TITLE>Print Environment</TITLE></HEAD><BODY>'
print ' </BODY> </HTML>'
Mark Sapiro <mark at msapiro.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
More information about the Mailman-Users