how-to POST form data to ASP pages?

livin livin at
Sun Jan 1 20:18:46 EST 2006


The library is the PC version of 2.3  --- I have done some more testing.

I simplified my .py to only 2 lines...

import urllib
urllib.urlopen('http://192.168.1.11', urllib.urlencode({'control_device':
'Kitchen Lights=off'}))

I get this error...

File "Q:\python\python23.zlib\urllib.py", line 78, in urlopen
File "Q:\python\python23.zlib\urllib.py", line 183, in open
File "Q:\python\python23.zlib\urllib.py", line 297, in open_http
File "Q:\python\python23.zlib\httplib.py", line 712, in endheaders
File "Q:\python\python23.zlib\httplib.py", line 597, in _send_output
File "Q:\python\python23.zlib\httplib.py", line 564, in send
File "Q:\python\python23.zlib\httplib.py", line 548, in connect
IOError
:
[Errno socket error] (10060, 'Operation timed out')

I've taken the commands I'm using from working HTTP & ASP pages.

Here's actual code from an HTML page I'm using for the same device I'm
trying in my .PY...

<form method="post">
<td nowrap class="tableroweven">
<a name="bm83274"></a>
<input type="hidden" name="bookmark" value="83274">
<input type="hidden" name="ref_page" value="stat">
<input type="hidden" name="control_device" value="Kitchen Lights">
<input class="formbutton" type="submit" name="action_on" value="On">
<input class="formbutton" type="submit" name="action_off" value="Off">
<select class="formdropdown" name="selectdim" SIZE="1"
onchange="SubmitForm(this)">
<option selected value="0">0%</option>
<option value="10">10%</option>
<option value="20">20%</option>
<option value="30">30%</option>
<option value="40">40%</option>
<option value="50">50%</option>
<option value="60">60%</option>
<option value="70">70%</option>
<option value="80">80%</option>
<option value="90">90%</option>
<option value="100">100%</option>
</select>
</td></form>



"Dennis Lee Bieber" <wlfraed at ix.netcom.com> wrote in message 
news:bkfgr11u46rdafolb5kmklqusgoln4atf4 at 4ax.com...
> On Sun, 1 Jan 2006 12:35:06 -0700, "livin" <livin@@cox.net> declaimed
> the following in comp.lang.python:
>
>> IOError
>> :
>> [Errno socket error] (10057, 'Socket is not connected')
>>
>
> That doesn't look like anything to do, directly, with parameter
> encodings... Rather, it looks like your server is closing the connection
> unexpectedly.
>
> You've got the Python source for everything down to the call to
> "sendall", examine it -- it might help figure out where things are
> failing. ("sendall" looks to be in a compiled module)
>
>
> -- 
> > ============================================================== <
> >   wlfraed at ix.netcom.com  | Wulfraed  Dennis Lee Bieber  KD6MOG <
> >      wulfraed at dm.net     |       Bestiaria Support Staff       <
> > ============================================================== <
> >           Home Page: <http://www.dm.net/~wulfraed/>            <
> >        Overflow Page: <http://wlfraed.home.netcom.com/>        < 





More information about the Python-list mailing list