View Full Version : Python and Httplib example required

September 1st, 2008, 01:54 PM

I am a competent(?) enough programmer but it's with web pages in asp.net on MS platforms.

I tried python a little a while ago as it seems to be a big one on Linux but gave up due to lack of interest. I usually have to to have a need to learn something and here it is!

On a Qnap NAS I have, some data I want to viev in logs are several clicks away. I have found using wireshark sniffer that a properly formatted http://bla-bla/cgi/bla-bla page on the qnap gives me my results without going thru the menus but I still need to authenticate, Firefox askes username/password.

This is a perfect example of a desire to force me to learn.

I've seen I will use httplib (libraries?) in python so am getting there.

I want to get this web page, authenticate if necessary then I can parse the HTMP for the data I wan't. Eventually building up to a monitor program I suppose for various bits.

Can someone with more knowledge in this area here point me to a sample code of authenticating and reading a page from a web server using python? It's the authenticating bit that seems fuzzy in my googling for answers, perhaps I just don't know what i'm looking for.


September 1st, 2008, 02:17 PM
As this is all new to me, a quick jump start.

Rather fancy Stani editor because it's for windows also.

So can I use Stani editor and do I use wxGlade for the form designer? it's just synaptic installed wxGlade by default when I installed stani editor.

EDIT : I'm a bit lost here, we also have Glade, just straightforward Glade. (I hate starting something new!)
EDIT2 : Wait!, as far as IDE goes, it looks like Glade and Stani, found a sample on the net and i'm happy with this bit now.


Martin Witte
September 1st, 2008, 08:20 PM
Did you already take a look at the python documentation (http://docs.python.org/lib/httplib-examples.html)?

September 2nd, 2008, 10:36 AM
Yes, I did see that but was unable to ascertain how it was authenticating so come to the conclusion that it wasn't and therefor this piece of code would not help me.


August 21st, 2010, 11:47 AM
Python httplib example -> http://www.kumarchetan.com/blog/2010/08/21/python-httplib-example/
I know am late but its a very very simple example.