It is running as a cronjob on a VPS(Virutal Private Server). The output html can be served by any web server.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #!/usr/bin/env python
from BeautifulSoup import BeautifulSoup
import urllib2
from pprint import pprint
from contextlib import closing
from contextlib import nested
url='http://www.python.org/community/jobs/'
jobs='/var/www/vhosts/jobs.dev/index.html'
with nested(closing(urllib2.urlopen(url)), open(jobs,'w')) as (stream,myout):
html=stream.read()
soup=BeautifulSoup(html)
print >>myout,"<html><body>"
sections=soup.findAll('div',{'class':'section'})
for section in sections:
#find the job which has not allowed the telecommuting
if section.findAll(lambda tag: tag.findAll('li',text='Telecommuting OK')):
print >>myout,section
print >>myout,"</body></html>"
|