473,387 Members | 1,742 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,387 software developers and data experts.

RE: [wwwsearch-general] (no subject)

Hi john.

Thanks for your reply. I tried your suggestion of using RobustFactory, and
still get a badly maligned html back!!! The html is listed below. I would
have thought that the mech process, would have interpreted the
"http-equiv="refresh" Unfortunately, mechanize apparently isn't able to
handle a "<meta http-equiv="refresh" url="/foo/..."when it's inside the
<bodyof the html...

test.html
------------------------------------------------------------------
<html>
<head>
<TITLE></TITLE>
</head>

<BODY BGCOLOR="#FFFFFF">

<TD NOWRAP WIDTH="45" VALIGN="top"><A
HREF="javascript:openAWindow('http://www.registrar.psu.edu/faculty_staff/enr
oll_services/clsrooms.html#C','Intent',625,425,1)"><FONT FACE="Arial,
Helvetica, sans-serif" SIZE="2"><strong>Tech Type</strong></FONT></A></TD>

<META HTTP-EQUIV="Refresh" CONTENT="0;url=/soc/fall/Alloz/a-c/acctg.html#">

---------------------------------------------------------------------------

as you can see, there is no closing </body></htmltag....

thanks
stripped down, test code...
----------------------------------------
from mechanize import Browser
import mechanize
br = Browser()

br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.set_handle_refresh(True)
br.addheaders = [('User-Agent', 'Firefox')]

url="http://schedule.psu.edu/act_main_search.cfm?Semester=FALL%202008%20%20%
20%20&CrseLoc=OZ%3A%3AAbington%20Campus&CECrseLoc= AllOZ%3A%3AAbington%20Camp
us&CourseAbbrev=ACCTG&CourseNum=&CrseAlpha="

br.open(url)
res = br.response() # this is a copy of response
s = res.read()
print "slen=",len(s)
print s

sys.exit()
----------------------------------
-----Original Message-----
From: py*****************************************@python .org
[mailto:py***************************************** @python.org]On Behalf
Of John J Lee
Sent: Friday, August 29, 2008 12:34 PM
To: ww***************@lists.sourceforge.net
Cc: py*********@python.org
Subject: Re: [wwwsearch-general] (no subject)
On Fri, 29 Aug 2008, bruce wrote:
[...]
does the page (test.html) need to be completely valid html?
No, but there are certainly (poorly-defined) limitations.

I haven't tried to understand your script or the HTML, but did you try
this:

br = mechanize.Browser(mechanize.RobustFactory())
....
John

--
http://mail.python.org/mailman/listinfo/python-list

Aug 29 '08 #1
0 693

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: gsb | last post by:
HOW TO: Submit a form to PHP with no return? I need to submit a form for file upload to a PHP script but do not want anything returned. That is the TARGET for the form should be like a null...
1
by: Jeff Sandys | last post by:
Can you include a subject with sendmail using smtplib? When I do this (names changed to protect the innocent): import smtplib toadr = "me@myisp.com" frmadr = "myhost@myhost.com" msg = "this...
3
by: Gert-Jan van Middelkoop | last post by:
Hi, I'm using an e-mailform on my website. I would like to make a dropdownmenu with several subjects, so when the e-mail arrives I can immediatly see it's subject. Therefore, this code must...
6
by: Susan | last post by:
Is there any way to take one of the fields from the form and use that as your subject line.. right now I have a default subject line entered - but would rather have the subject be the information...
1
by: kamlai | last post by:
I've written the following codes to include utf-8 wordings in both the subject and the content. $headers = "MIME-Version: 1.0\r\n". "Content-type: text/plain; charset=utf-8\r\n". "From:...
3
by: Laangen_LU | last post by:
Dear Group, my first post to this group, so if I'm on the wrong group, my apologies. I'm trying to send out an email in Chinese lanuage using the mail() function in PHP. Subject and...
3
by: b. dougherty | last post by:
Greetings all- I am trying to extract subject headers from emails that have been saved as text files. The subject headers are in MIME UTF-8 format, and so they appear like this: subject:...
4
by: Alec MacLean | last post by:
Is anyone aware of a size limit imposed on the subject text when using the System.Net.Mail library? I'm getting problems of message not being recieved if the subject exceeds 15 chars. Thx
7
by: plumba | last post by:
I am working on a html form for work, I need to make the Subject of the email which the form produces to be unique each time. The subject is currently hard coded in, in the format of:<form...
5
by: Alan Isaac | last post by:
I have two questions about the "observer pattern" in Python. This is question #1. (I'll put the other is a separate post.) Here is a standard example of the observer pattern in Python:
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.