Python for ASP

Henk Punt henk.punt
Mon Sep 25 08:18:01 EDT 2000


Hi George,

Why do you want to write a HTTP client yourself?, if it is for fun, go
ahead,
but if you just need to accomplish some other task, then I would suggest
using
the builtin HTTP client of the windows xml parser (MSXML.dll).
This parser has been distributed with IE5, and since you are using w2k, I
assume
that it is installed. This http client is a COM component and as such is
usable from
any COM aware scripting language (including python).
I will show you how to access it from JavaScript in ASP (Look up docs for
VBScript or Python to
see how COM components are instantiated there):

var http_client=Server.CreateObject("Microsoft.XMLHTTP");

//open page with get method, given url, and don't do it asynchronously
http_client.open("GET", "http://www.microsoft.com", false);
http_client.send();  //get it

//now the http text can be retreived by: //it is a string
var html=http_client.responseText;

You may want to check the docs for MSXML on
http://msdn.microsoft.com/xml
for details.

It also works for secure http.

Bye

Henk.

"George Jempty" <jb4mt at webfielding.com> wrote in message
news:dpGz5.1931$ve5.174290 at news-east.usenetserver.com...
> I'm trying to write an HTTP client using ASP, but don't think I can do
that
> with VBScript, so am trying Python instead.
>
> What do I need to do to be able to use Python with Active Server Pages?
It
> won't just work with ASP "out of the box": I get this as an error message
> when I just set the language directive: <%@ LANGUAGE = Python %>
>
> Error Type:
> Active Server Pages, ASP 0129 (0x80004005)
> The scripting language 'Python' is not found on the server.
> /whatever.asp, line 1
>
> This is on Win2000/IIS 5, with Python 1.5.2.  The tutorial at
> http://starship.python.net/crew/pirx/asp/py_asp.html doesn't address the
> configuration issue.
>
> Thanks in advance
>
> George
>
>





More information about the Python-list mailing list