HTTP & tcl

Fuzzyman fuzzyman at gmail.com
Thu Feb 16 03:43:25 EST 2006


alf wrote:
> Hi
>
> I would like to convert the wctpXml-1.3.py program to Tcl (line by
> line).
> See http://sourceforge.net/project/showfiles.php?group_id=29217
> This program sends pages using WCTP.  I know nothing about Python or
> XML but this program is small and seems straightforward and I am sure
> that I will be able to figure it out - with a little help ;-)
> Currently I am stuck in not being able to identify the Tcl equivalent
> of Python's "putrequest", as in:
> h = httplib.HTTP("wctp.skytel.com",80)
> h.putrequest("POST","/wctp")
>

You'll get more help on Tcl syntax in a Tcl group. :-)

Of the HTTP object, the Python documentation says :

The HTTP class is retained only for backward compatibility with 1.5.2.
It should not be used in new code. Refer to the online docstrings for
usage.

(Meaning that you will find more help on the use of that module in the
source code - which can also be accessed through Python's pydoc
feature).


I assume it does what the newer ``HTTPConnection`` class does. The
putrequest method does the following :

putrequest( request, selector[, skip_host[, skip_accept_encoding]])

This should be the first call after the connection to the server has
been made. It sends a line to the server consisting of the request
string, the selector string, and the HTTP version (HTTP/1.1). To
disable automatic sending of Host: or Accept-Encoding: headers (for
example to accept additional content encodings), specify skip_host or
skip_accept_encoding with non-False values. Changed in version 2.4:
skip_accept_encoding argument added.

In other words - you're creating an HTTP connection and request. You'll
need to find an 'equivalent' library for Tcl and convert the request
using hte semantics of whatever library you choose.


All the best,

Fuzzyman
http://www.voidspace.org.uk/python/index.shtml

> Thanks
> alf




More information about the Python-list mailing list