views:

197

answers:

1

Here's the scenario: I need to connect to a web site to retrieve electronic lab results formatted in XML. In order to connect, I need to use a digital certificate.

I've been able to get a version of this working in Perl. It looks like this:

#!/usr/bin/env perl

use strict;
use WWW::Mechanize;
$|++;

my $username = 'xxx';
my $password = 'yyy';

$ENV{HTTPS_PKCS12_FILE}     = 'CERTFILE.pfx';
$ENV{HTTPS_PKCS12_PASSWORD} = 'PathCert';

my $mech = WWW::Mechanize->new();
$mech->agent_alias('Windows IE 6');

$mech->get("https://www.example.org/xyz/,DanaInfo=999.33.1.10+");
$mech->get("https://www.example.org/xyz/isapi_pathnet.dll?Page=Login&Mode=Silent&UserID=xxx&Password=yyy,DanaInfo=999.33.1.10");
$mech->get("https://www.example.org/xyz/isapi_pathnet.dll?Page=HL7&Query=NewRequests,DanaInfo=999.33.1.10");

print $mech->content();

Now, this works when I run it from my workstation. However:

  • If I compile it using perl2exe, it doesn't work.
  • If I try to compile it with pp (e.g. "pp -r sslclient.pl"), all I get back is "500 SSL negotiation failed:"
  • If I copy this whole directory to another computer, the script simply hangs at the first $mech->get() statement.
  • What I really want is to find an equivalent to this in Python (the rest of my app is Python), but so far no luck.

So, plenty of problems here. Anyone have any ideas?

A: 

I have no idea what is going on with your perl issues. However, mechanize for Python can be found here.

Andrew McGregor