-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpythonjobboard.py
More file actions
23 lines (19 loc) · 841 Bytes
/
Copy pathpythonjobboard.py
File metadata and controls
23 lines (19 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/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'
jobs='/Users/gregchristian/Documents/workspace/mustardseed7/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>"