ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/FreeBSDAdmin/Reminder/website.py
Revision: 1131
Committed: 2008-12-21T01:48:02-08:00 (16 years, 6 months ago) by douglas
Content type: text/x-python
File size: 771 byte(s)
Log Message:
I, for one, welcome our new Google overlords. At least their Calendar integration with my G1.

File Contents

# Content
1 # Website
2 #
3 # Douglas Thrift
4 #
5 # $Id$
6
7 from BeautifulSoup import BeautifulSoup
8 import mechanize
9
10 # XXX: hack to make Wells Fargo http-equiv redirects actually work
11 mechanize._http.AbstractHeadParser.head_elems = tuple(list(mechanize._http.AbstractHeadParser.head_elems) + ['body'])
12
13 class Website(object):
14 Soup = BeautifulSoup
15
16 def __init__(self, debug):
17 self.browser = mechanize.Browser()
18 self.browser.addheaders = [('User-agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/0.4.154.25 Safari/525.19')]
19
20 if debug:
21 self.browser.set_debug_http(True)
22
23 self.browser.set_handle_equiv(True)
24 self.browser.set_handle_redirect(True)
25 self.browser.set_handle_refresh(True)
26 self.browser.set_handle_robots(False)

Properties

Name Value
svn:keywords Id