By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,548 Members | 1,497 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,548 IT Pros & Developers. It's quick & easy.

Mechanize/Browser question

P: n/a
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...

thanks

-bruce
Jul 10 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
Jul 10 '06 #2

P: n/a
"Diez B. Roggisch" <de***@nospam.web.dewrites:
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.
There are better/other ways which I've already pointed bruce to on the
mailing list that covers module mechanize
(ww***************@lists.sourceforge.net).

I've asked Bruce not to cross-post all this stuff -- partly since he's
not likely to get a good answer from anybody but me and the others on
that list, but also to avoid irritating everybody on c.l.py ;-)
John
Jul 10 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.