Mechanize/Browser question
Diez B. Roggisch
deets at nospam.web.de
Mon Jul 10 13:09:48 EDT 2006
bruce schrieb:
> hi...
>
> i can do the following
> br = Browser
> br.open("www.yahoo.com")
> br.open("file:///foo")
>
> but can i do
> s = "..." <<<< qualified html text
> br.open(s)
>
> i'm curious, if i have html from someother source, is there a way to simply
> get it into the "Browser" so i can modify it...
Use the tempfile-module to create a temporary file, write your HTML in
there and point the browser to it. Alternatively, you could fire up a
SimpleHTTPServer and serve the content. For HTML-only this would be
overkill, but if you need images as well it might be worth it.
Diez
More information about the Python-list
mailing list