urllib POST question

Peter Hansen peter at engcorp.com
Sat Jun 22 13:05:01 EDT 2002


rdack wrote:
> 
> Peter Hansen <peter at engcorp.com> wrote in message news:<3D13D62B.D7AE6554 at engcorp.com>...
> > > > In article <644f6688.0206200930.48110837 at posting.google.com>, rdack wrote:
> > > > > i am doing a POST to a server using urllib and it works.
> > > > > is there some way i can see exactly what is being posted?
> > > > > a way to get the post object out of urllib - the exact lines it is sending?
> > Howzabout this?
> >
> > >>> import httplib
> > >>> httplib.HTTPConnection.debuglevel = 1
> > >>> import urllib
> > >>> page = urllib.urlopen('yoururlhere').read()
> 
> perfect! thanks. although i was able to install ethereal and see the
> packet-it was the 100 megabyte solution.
> this was the zero byte solution.
> of course, now i have the roll royce of packet sniffers.
> anyway - you are right - python-rocks - when you know which button to
> push. :-).

The right button was "Use the Source, Luke!".  I found in urllib
that it was doing an h = httplib.HTTP() so I went to httplib and
found that the class had a debuglevel field which was used to 
control that feature.  This button is available for most other
Python modules, too.  ;-)

-Peter



More information about the Python-list mailing list