Mechanize/Browser question

B

bruce

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
 
D

Diez B. Roggisch

bruce said:
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
 
J

John J. Lee

Diez B. Roggisch said:
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
([email protected]).

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top