search multiple dictionaries efficiently?

2006-01-17 Thread Livin
I'm a noobie so please be easy on me. I have searched a ton and did not find 
anything I could understand.

I'm using py2.3

I've been using Try/Except but this gets long with multiple dictionaries.

I found some code on web pages and such but cannot get them to work. Any 
help is appreciated as I need to search multiple dictionaries for keys.



here's the code I found but cannot get to work...

dict_set = (self.dictHSdevices, self.dictHSevents, self.dictHSbtnDevices) 
-- /creates set of dictionaries/

/code to search the set/--

   val = [ d for d in dict_set if d[value] in dict_set ]
OR
   for key, value in dict.iteritems(): pass




-- 
http://mail.python.org/mailman/listinfo/python-list


creating dictionarie names, using variables?

2006-01-11 Thread Livin
I need to dynamically create dictionary names using strings input at the 
time of creation. These will then be placed into a Parent dictionary.

I'm new to python, and programming, so please bear with me.

here's my initial thought but I don't think it will work...

item[5]='Kitchen Ceiling Lights'
devDictName = item[5].replace(' ','+')
'dict_'+devDictName = [{'Group':item[2], 'Status':item[3], 
'DimLevel':item[4], 'DeviceName':item[5], 'Location':item[6], 
'HouseCode':item[7], 'LastChange':item[8], 'DeviceType':item[9], 
'CanDim':item[10], 'Values':item[11]}]
dictDevices[item[0],'dict_'+devDictName]


thanks for the help! 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: creating dictionarie names, using variables?

2006-01-11 Thread Livin
Are you saying that each child dictionary actually has its own 'key', not 
just the items within it?


The goal is to create a dictionary with many dictionaries in it.
 - each child dictionary will hold a single 'device' and its related 
attributes.
 - I want to name the child dictionaries the same as their device name so it 
is easy to call them from within the dictionary.
 - also, they dictionary will be dynamic, thus the # of devices is always 
changing so they need to be created on-the-fly.




Dan Sommers [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Wed, 11 Jan 2006 15:53:48 -0700,
 Livin [EMAIL PROTECTED] wrote:

 I need to dynamically create dictionary names using strings input at
 the time of creation. These will then be placed into a Parent
 dictionary.

 Don't do that.

 item[5]='Kitchen Ceiling Lights'

 devDictName = item[5].replace(' ','+')
 'dict_'+devDictName = [{'Group':item[2], 'Status':item[3],
 'DimLevel':item[4], 'DeviceName':item[5], 'Location':item[6],
 'HouseCode':item[7], 'LastChange':item[8], 'DeviceType':item[9],
 'CanDim':item[10], 'Values':item[11]}]

 This is a list that contains one item, and that one item happens to be a
 dictionary.  Is this really what you want?

 dictDevices[item[0],'dict_'+devDictName]

 Put the dictionaries you create into another dictionary instead:

 devDict = { }

 key = item[5].replace(' ','+')

 devDict[key] = {'Group':item[2],
'Status':item[3], # etc.
   }

 HTH,
 Dan

 -- 
 Dan Sommers
 http://www.tombstonezero.net/dan/ 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help Please: 'module' object has no attribute 'compile'

2006-01-08 Thread livin
Oh, no I did not create any modules, wish I had the knowledge to do so!

I think I've moved beyond whatever that issue was and now getting a timeout. 
The info is below... any help you can give is appreciate!


I'm running this code...

import os, re, string, urllib, types
data = urllib.urlencode({'control_device': 'Kitchen Lights=on'})
urllib.urlopen('http://192.168.1.11', data)


and get this error log from Python...

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')


Kent Johnson [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 livin wrote:
 I beleive so... I cannot know for sure becasue the models are not 
 separate... they are in the python23.zlib file... I'm no sure how to 
 check the file, it looks as if it is compiled (I'm new to python so 
 forgive my ignorance)

 Yes, there should be an re module in your Python distribution, and it 
 should have a compile attribute. You can check this from the python 
 intepreter easily:
   import re
   re.compile
 function compile at 0x008FE0B0

 What I am suggesting is that YOU may have created a module named re that 
 Python is finding instead of the system module by that name. In this case 
 your module doesn't have a compile attribute. This would cause the error 
 you see.

 Kent



 Kent Johnson [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]

livin wrote:

my log...

INFO urllib.urlopen('http://192.168.1.11/hact/kitchen.asp', 
urllib.urlencode({'Action': 'hs.ExecX10ByName+Kitchen+Lights%2C+On 
%2C+100x=4y=6'}))
INFO
 INFO   File Q:\python\python23.zlib\urllib.py, line 78, in urlopen
INFO   File Q:\python\python23.zlib\urllib.py, line 159, in open
INFO   File Q:\python\python23.zlib\urllib.py, line 957, in splittype
INFO AttributeError
INFO :
INFO 'module' object has no attribute 'compile'

That line reads
_typeprog = re.compile('^([^/:]+):')

Do you have a module named 're' that is shadowing the library module of 
the same name?

Kent

 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how-to POST form data to ASP pages?

2006-01-08 Thread livin
Any ideas on how to troubleshoot the 'Operation timed out' error, or 
work-around it?

I'm just sending a POST to a windows-based web server (non-IIS).

thanks!


livin livin@@cox.net wrote in message 
news:[EMAIL PROTECTED]
 Dennis, Alan, Mike... help?

 According to the HomeSeer (I'm trying to trigger events on the HomeSeer 
 application) documentation I do not need to use ASP. The simple HTTP 
 command should be accepted directly from a HTML page.

 Here's the page in the online manual for Homeseer with the info:

 HomeSeer info on Controlling Devices from HTML - 
 http://www.homeseer.com/support/homeseer/WebHelp/web_access/controlling_devices_and_events_from_your_own_pages.htm


 I appreciate the assistance.



 livin livin@@cox.net wrote in message 
 news:[EMAIL PROTECTED]
 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=00%/option
 option value=1010%/option
 option value=2020%/option
 option value=3030%/option
 option value=4040%/option
 option value=5050%/option
 option value=6060%/option
 option value=7070%/option
 option value=8080%/option
 option value=9090%/option
 option value=100100%/option
 /select
 /td/form



 Dennis Lee Bieber [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 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)


 -- 
  == 
[EMAIL PROTECTED]  | Wulfraed  Dennis Lee Bieber  KD6MOG 
   [EMAIL PROTECTED] |   Bestiaria Support Staff   
  == 
Home Page: http://www.dm.net/~wulfraed/
 Overflow Page: http://wlfraed.home.netcom.com/



 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help Please: 'module' object has no attribute 'compile'

2006-01-07 Thread livin
I beleive so... I cannot know for sure becasue the models are not 
separate... they are in the python23.zlib file... I'm no sure how to check 
the file, it looks as if it is compiled (I'm new to python so forgive my 
ignorance)


Kent Johnson [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 livin wrote:
 my log...

 INFO urllib.urlopen('http://192.168.1.11/hact/kitchen.asp', 
 urllib.urlencode({'Action': 'hs.ExecX10ByName+Kitchen+Lights%2C+On 
 %2C+100x=4y=6'}))
 INFO
  INFO   File Q:\python\python23.zlib\urllib.py, line 78, in urlopen
 INFO   File Q:\python\python23.zlib\urllib.py, line 159, in open
 INFO   File Q:\python\python23.zlib\urllib.py, line 957, in splittype
 INFO AttributeError
 INFO :
 INFO 'module' object has no attribute 'compile'

 That line reads
 _typeprog = re.compile('^([^/:]+):')

 Do you have a module named 're' that is shadowing the library module of 
 the same name?

 Kent 


-- 
http://mail.python.org/mailman/listinfo/python-list


Help Please: 'module' object has no attribute 'compile'

2006-01-06 Thread livin
my log...

INFO urllib.urlopen('http://192.168.1.11/hact/kitchen.asp', 
urllib.urlencode({'Action': 'hs.ExecX10ByName+Kitchen+Lights%2C+On 
%2C+100x=4y=6'}))
INFO
 INFO   File Q:\python\python23.zlib\urllib.py, line 78, in urlopen
INFO   File Q:\python\python23.zlib\urllib.py, line 159, in open
INFO   File Q:\python\python23.zlib\urllib.py, line 957, in splittype
INFO AttributeError
INFO :
INFO 'module' object has no attribute 'compile'


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how-to POST form data to ASP pages?

2006-01-04 Thread livin
Dennis, Alan, Mike... help?

According to the HomeSeer (I'm trying to trigger events on the HomeSeer 
application) documentation I do not need to use ASP. The simple HTTP command 
should be accepted directly from a HTML page.

Here's the page in the online manual for Homeseer with the info:

HomeSeer info on Controlling Devices from HTML - 
http://www.homeseer.com/support/homeseer/WebHelp/web_access/controlling_devices_and_events_from_your_own_pages.htm


I appreciate the assistance.



livin livin@@cox.net wrote in message 
news:[EMAIL PROTECTED]
 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=00%/option
 option value=1010%/option
 option value=2020%/option
 option value=3030%/option
 option value=4040%/option
 option value=5050%/option
 option value=6060%/option
 option value=7070%/option
 option value=8080%/option
 option value=9090%/option
 option value=100100%/option
 /select
 /td/form



 Dennis Lee Bieber [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 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)


 -- 
  == 
[EMAIL PROTECTED]  | Wulfraed  Dennis Lee Bieber  KD6MOG 
   [EMAIL PROTECTED] |   Bestiaria Support Staff   
  == 
Home Page: http://www.dm.net/~wulfraed/
 Overflow Page: http://wlfraed.home.netcom.com/

 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how-to POST form data to ASP pages?

2006-01-01 Thread livin
Mike,
I'm not a coder really at all (I dabble with vbscript  jscript) but an 
asking for help to get this working.

I have tried this...

  params = urllib.urlencode({'action': 'hs.ExecX10ByName Kitchen 
Espresso Machine, On, 100'})
  urllib.urlopen(http://192.168.1.11:80/hact/kitchen.asp;, params)

Can you suggest the correct code to get this working?

I appreciate the help!

Aaron






Mike Meyer [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 livin livin@@cox.net writes:
 I need to post form data to an ASP page that looks like this on the page
 itself...
 form method='POST'input src=\icons\devices\coffee-on.gif type='image'
 align='absmiddle' width=16 height=16 title='Off'input type='hidden'
 value='Image' name='Action'input type='hidden' value='hs.ExecX10ByName
 Kitchen Espresso Machine, Off, 100'/form
 I've been trying this but I get a syntax error...
   params = urllib.urlencode({'hidden': 'hs.ExecX10ByName Kitchen
 Espresso Machine, On, 100'})
   urllib.urlopen(http://192.168.1.11:80/hact/kitchen.asp;, params)

 urlencode doesn't care about the type of the input element (or that
 the page is ASP), just the name/value pairs. You want:

   params = urllib.urlencode({'Action': 'Image', ...})

 The provided HTML doesn't say what the name of the second hidden input
 field is. It's not at all clear what should be passed to the server in
 this case.

 It looks like you tried to break a string across a line boundary, but
 that may be your posting  software. If you did, then that's what's
 generating a syntax error, and a good indication that you should try
 reading the tutorial.

mike
 -- 
 Mike Meyer [EMAIL PROTECTED] http://www.mired.org/home/mwm/
 Independent WWW/Perforce/FreeBSD/Unix consultant, email for more 
 information. 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how-to POST form data to ASP pages?

2006-01-01 Thread livin
Hi Alan,

I have tried the code you suggested and a more simple set of post parameters 
(below).

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


Either way I get this error log...

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 576, in send
File string, line 1, in sendall
IOError
:
[Errno socket error] (10057, 'Socket is not connected')





Alan Kennedy [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 [livin]
 I'm not a coder really at all (I dabble with vbscript  jscript) but an 
 asking for help to get this working.

 I have tried this...

   params = urllib.urlencode({'action': 'hs.ExecX10ByName Kitchen 
 Espresso Machine, On, 100'})
   urllib.urlopen(http://192.168.1.11:80/hact/kitchen.asp;, params)

 You should try to phrase your question so that it is easier for us to 
 understand what is going wrong, and thus help you to correct it.

 As Mike already suggested, you have a string that may be spread over two 
 lines, which would be illegal python syntax, and which would give a 
 SyntaxError if run. You should be sure that this is not the cause of your 
 problem before going further.

 The following code should do the same as the above, but not suffer from 
 the line breaks problem.

 name_value_pairs = {
   'action': 'hs.ExecX10ByName Kitchen Espresso Machine, On, 100'
 }
 params = urllib.urlencode(name_value_pairs)
 urllib.urlopen(http://192.168.1.11:80/hact/kitchen.asp;, params)

 BTW, it looks to me like you may be opening up a security hole in your 
 application. The following string looks very like a VB function 
 invocation: 'hs.ExecX10ByName Kitchen Espresso Machine, On, 100'

 Are you executing the contents of form input fields as program code? 
 That's highly inadvisable from a security point of view.

 Happy New Year.

 -- 
 alan kennedy
 --
 email alan:  http://xhaus.com/contact/alan 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how-to POST form data to ASP pages?

2006-01-01 Thread livin
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=00%/option
option value=1010%/option
option value=2020%/option
option value=3030%/option
option value=4040%/option
option value=5050%/option
option value=6060%/option
option value=7070%/option
option value=8080%/option
option value=9090%/option
option value=100100%/option
/select
/td/form




Alan Kennedy [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 [livin]
 I have tried the code you suggested and .. .. Either way I get this error 
 log...

 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 576, in send
 File string, line 1, in sendall
 IOError
 :
 [Errno socket error] (10057, 'Socket is not connected')

 OK, now we're getting somewhere.

 As you can probably guess from the error message, the socket through which 
 urllib is making the request is not connected to the server. We have to 
 figure out why.

 That library path is unusual: Q:\python\python23.zlib\httplib.py

 Python supports reading library modules from a zip file, but the standard 
 installations generally don't use it, except for Python CE, i.e. Python 
 for Microsoft Windows PocketPC/CE/WTF. Is this the platform that you're 
 using? If I remember rightly, Python for Pocket Windows doesn't support 
 sockets, meaning that urllib wouldn't work on that platform.

 Another thing to establish is whether the URL is working correctly, from a 
 client you know works independently from your script above, e.g. an 
 ordinary browser. When you submit to your form handling script from an 
 ordinary browser, does it work?

 -- 
 alan kennedy
 --
 email alan:  http://xhaus.com/contact/alan 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how-to POST form data to ASP pages?

2006-01-01 Thread livin
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=00%/option
option value=1010%/option
option value=2020%/option
option value=3030%/option
option value=4040%/option
option value=5050%/option
option value=6060%/option
option value=7070%/option
option value=8080%/option
option value=9090%/option
option value=100100%/option
/select
/td/form



Dennis Lee Bieber [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 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)


 -- 
  == 
[EMAIL PROTECTED]  | Wulfraed  Dennis Lee Bieber  KD6MOG 
   [EMAIL PROTECTED] |   Bestiaria Support Staff   
  == 
Home Page: http://www.dm.net/~wulfraed/
 Overflow Page: http://wlfraed.home.netcom.com/ 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how-to POST form data to ASP pages?

2005-12-27 Thread livin
Mike,
I appreciate the help... I'm a noobie to Python. I know vbscript  jscript 
but nothing else.

I obviously do not need to submit the images

my code looks like this but it is not working... any ideas?


  params = urllib.urlencode({'action': 'hs.ExecX10ByName Kitchen 
Espresso Machine, Off, 100'})
  urllib.urlopen(http://192.168.1.11:80/hact/kitchen.asp;, params)



Mike Meyer [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 livin livin@@cox.net writes:
 I need to post form data to an ASP page that looks like this on the page
 itself...
 form method='POST'input src=\icons\devices\coffee-on.gif type='image'
 align='absmiddle' width=16 height=16 title='Off'input type='hidden'
 value='Image' name='Action'input type='hidden' value='hs.ExecX10ByName
 Kitchen Espresso Machine, Off, 100'/form
 I've been trying this but I get a syntax error...
   params = urllib.urlencode({'hidden': 'hs.ExecX10ByName Kitchen
 Espresso Machine, On, 100'})
   urllib.urlopen(http://192.168.1.11:80/hact/kitchen.asp;, params)

 urlencode doesn't care about the type of the input element (or that
 the page is ASP), just the name/value pairs. You want:

   params = urllib.urlencode({'Action': 'Image', ...})

 The provided HTML doesn't say what the name of the second hidden input
 field is. It's not at all clear what should be passed to the server in
 this case.

 It looks like you tried to break a string across a line boundary, but
 that may be your posting  software. If you did, then that's what's
 generating a syntax error, and a good indication that you should try
 reading the tutorial.

mike
 -- 
 Mike Meyer [EMAIL PROTECTED] http://www.mired.org/home/mwm/
 Independent WWW/Perforce/FreeBSD/Unix consultant, email for more 
 information. 


-- 
http://mail.python.org/mailman/listinfo/python-list


how-to POST form data to ASP pages?

2005-12-26 Thread livin
I need to post form data to an ASP page that looks like this on the page 
itself...

form method='POST'input src=\icons\devices\coffee-on.gif type='image' 
align='absmiddle' width=16 height=16 title='Off'input type='hidden' 
value='Image' name='Action'input type='hidden' value='hs.ExecX10ByName 
Kitchen Espresso Machine, Off, 100'/form

I've been trying this but I get a syntax error...
  params = urllib.urlencode({'hidden': 'hs.ExecX10ByName Kitchen 
Espresso Machine, On, 100'})
  urllib.urlopen(http://192.168.1.11:80/hact/kitchen.asp;, params)

Can someone help out and validate I'm on the right/wrong track and help with 
the syntax?

thanks!




-- 
http://mail.python.org/mailman/listinfo/python-list


Example Script to parse web page links and extract data?

2005-09-14 Thread livin
I'm hoping someone knows of an example script I can see to help me build 
mine.

I'm looking for an easy way to automate the below web site browsing and pull 
the data I'm searching for.
Here's steps it needs to accomplish...

1) login to the site (windows dialog when hitting web page)  *optional*

2) Choose menu link from ASP page (script shows/hides menu items depending 
on mouseover) *optional*

3) Basic Search Form and enter zip code or city to pull all the data.

4) After search, table shows many links (hundreds sometimes) to the actual 
data I need.
Links are this format... a href=javascript:GetAgent('AA059')

5) Each link opens new window with table providing required data.
The URLs that each href opens is this... 
http://armls.marketlinx.com/Roster/Scripts/Member.asp?PubID=AA059 where the 
PubID is record I need.

Table format looks like this:

tr

td bgcolor=#C0C0C0 align=center

a href=javascript:GetAgent('MA142')

font face=Arial size=26/font/a/td

tdfont face=Arial size=2

a href=javascript:GetAgent('MA142')Alaze/abr/font/td

tdfont face=Arial size=2Mark br/font/td


tdfont face=Arial size=2MA142/fontbr

/td

tdfont face=Arial size=2

a href=javascript:GetBroker('COLD56')Banker Success 
Realty/abr/font/td

tdCOLD56/td

tdfont face=Arial size=2script LANGUAGE=javascript

!--

writePhoneNumber('480-999-');

//--/script/td

/tr





-- 
http://mail.python.org/mailman/listinfo/python-list