473,405 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Mechanize/Browser question

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
2 1520
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: bruce | last post by:
hi... it appears that i'm running into a possible problem with mechanize/browser/python rgarding the "select_form" method. i've tried the following and get the error listed: br.select_form(nr...
0
by: bruce | last post by:
hi... update to an ongoing issue i've been having regarding html/Browser and selecting forms. i've created a basic test app, and created a stripped down page of html. the html has a single...
12
by: John | last post by:
I have to write a spyder for a webpage that uses html + javascript. I had it written using mechanize but the authors of the webpage now use a lot of javascript. Mechanize can no longer do the job....
1
by: comeshopcheap | last post by:
Hi I am using this script to access doba.com (I need to download some files) but I keep on being sent back to the login page not the user home page. Any help. I think I may need to use a post...
2
by: Patrick C | last post by:
I'm trying to learn the basics of the mechanize module and i'm very very new to programming. Does anyone know of some good places to learn the very basics, say with some examples as well? I found...
0
by: bruce | last post by:
i'm getting the following error: mechanize._response.httperror_seek_wrapper: HTTP Error 500: i'm running python 5.1 and mechanize 0.1.7b I have no idea as to what I have to...
1
by: Neal Becker | last post by:
I'm trying to use mechanize to read for a M$ mail server. I can get past the login page OK using: import mechanize b = mechanize.Browser() b.open...
0
by: Mohamed Yousef | last post by:
Hello , i don't know about mechanize but in general all you have to do is a simple socket text sending connect to the server then send it POST headers to page in question.. what to send ?...
2
by: Rex | last post by:
Hello, I am working on an academic research project where I need to log in to a website (www.lexis.com) over HTTPS and execute a bunch of queries to gather a data set. I just discovered the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.