I have a Python web client that uses urllib2. It is easy enough to
add my own HTTP headers to the outgoing requests. I just create a
dictionary of the headers I want to add, and pass it to the Request
initializer.
These custom headers are not all that gets sent. urllib2 attaches
headers also. Y
> I didn't try it, but the Request Class from urllib2 has a method
> called, header_items(). That could be what your looking for.
yes, that method only shows you all the headers added by urllib2.
there are other headers that are produced by httplib under the covers
that are added to the outgoing
> Looking at the httplib sources, the only headers it may add are Host,
> Accept-Encoding: identity, and Content-Length.
those are exactly the headers I want to capture.
do you know how to get a hold of them from a request using urllib2.
-Corey
--
http://mail.python.org/mailman/listinfo/pyth
> > Looking at the httplib sources, the only headers it may add are Host,
> > Accept-Encoding: identity, and Content-Length.
now that I think of it, if it is only 3 headers, I can just override
them explicitly from urllib2 and then log that.
thanks a lot for looking into the httplib source!
-
> This is a big deal in that while tkinter came with (just about) every
> Python the desire to use wxWidgets or Qt etc was high because tkinter
> widgets just look so horrid.
I liked Tk a lot, but also moved to wx because of Tk's L&F. Tk is
great for simple tool interfaces. Great news.
-Corey
-
> Why not use os.fork(), it is the same as C's fork?
os.fork is not cross platform. It is *nix only. Subprocess runs on
Windows also. The OP never specified his platform.
-Corey
--
http://mail.python.org/mailman/listinfo/python-list
> Release 213 is out already:
Tim, Mark,
this is great news.. thanks for tracking 3.x so closely. I big
barrier for me to eventually adopt 3.x is the ability to use pywin32.
thanks!
-Corey
--
http://mail.python.org/mailman/listinfo/python-list
> >> I am interested in writing an application that functions like a Unix
> >> or Linux top in the way it displays data.
> >> It should be command-line based but dynamically refreshing.
also check out the source for "dstat". It is written in python and
displays top-like information and more. It
> It doesn't show the debug output, any ideas?
I think like this:
opener = urllib2.build_opener(urllib2.HTTPHandler(debuglevel=1))
--
http://mail.python.org/mailman/listinfo/python-list
> Is there anyway I
> can get almost a screen capture of the page?
I'm not sure exactly what you mean by "screen capture". But the
webbrowser module in the standard lib might be of some help. You can
use it to drive a web browser from Python.
to load a page in your browser, you can do something
> You could try matplotlib:http://matplotlib.sourceforge.net.
+1 Matplotlib.
It's a very nice module with impressive graphing/charting/plotting
capabilities.
--
http://mail.python.org/mailman/listinfo/python-list
> Bascally it just grabs a page xy
> times and tells me how long it took.
you aren't doing a read(), so technically you are just connecting to
the web server and sending the request but never reading the content
back from the socket. So your timing wouldn't be accurate.
try this instead:
respons
> The problem is, that CentOS is running on the server and there is only
> 2.4 available. On wich version did you ran these tests?
I tested with Windows XP and Python 2.5.4. I don't have a 2.4 setup I
can easily test with.
you can try httplib rather than urllib2. httplib is slightly lower
level
> It might be, if the local server doesn't scale well enough to handle
> 100 concurrent requests.
true.. I didn't think of that. I was assuming the client machine
wasn't resource constrained. That would definitely lead to inaccurate
timings if that was the case.
--
http://mail.python.org/ma
> I suggest you look at matplotlib.
+1
Another vote Matplotlib. It has impressive graphing/plotting
capabilities and is used as a Python module/library.
Description from site:
"matplotlib is a python 2D plotting library which produces publication
quality figures in a variety of hardcopy formats
> Is there any module in python to open https
> sites through a proxy.
yes, you can use "urllib2".
from the urllib2 docs:
"The default is to read the list of proxies from the environment
variables"
So if you have a proxy setup, it should detect it from your
environment vars. If you want to spec
> So well, I'd like to know, do you people know any solution to this
> simple problem - making a user interact directly with a subprocess?
you might want something like Expect.
check out the pexpect module:
http://pexpect.sourceforge.net/pexpect.html
-Corey
--
http://mail.python.org/mailman/li
17 matches
Mail list logo