Doing POST opperations from Python (w/SSL, cookies and XML)

Jeffrey Kunce kuncej at mail.conservation.state.mo.us
Thu Sep 2 11:16:05 EDT 1999


>And for yet another code example, check out:
>   http://starship.python.net/crew/jrush/Webbot/ 
>...
>account register from my bank on the web.  It uses SSL to handle
>secure https:blah URLs, manages the cookies the bank sends

It says "To handle https: urls (i.e. SSL) you must have patched your httplib.py and 
urllib.py to support this, as well as acquire an implementation of SSL and pySSL."

Have you done that? Are there some good instructions somewhere?

Lately I've been doing "webbot" type stuff with COM and InternetExplorer.
I resisted at first (I prefer "pure python" solutions), but since there is no
pure python solution for https, I thought I'd give it a try. It's pretty cool.
https and XML/DOM are built in to MSIE. And once you find out
where all the information is*, and get started, it's very simple.

  --Jeff

*Here are some starting points. 

import win32com.client
ie = win32com.client.Dispatch("InternetExplorer.Application")

ie will respond to the protocols described  at
http://msdn.microsoft.com/workshop/browser/webbrowser/reference/ifaces/IWebBrowser2/IWebBrowser2.asp#IWebBrowser2 

for example:
ie.Navigate(url)
#some code to wait until (not ie.Busy)
node = ie.Document.body
# you can walk through nodes with
#  node.firstChild
#  node.nextSibling
# etc

you can set the values of inputs, submit forms, anything you can do manually in MSIE

some more pointers into the docs:
http://msdn.microsoft.com/workshop/author/dhtml/reference/objects.asp#om40_objects
http://msdn.microsoft.com/workshop/browser/mshtml/reference/ifaces/Document2/document2.asp









More information about the Python-list mailing list