1 import urllib2
2 from BeautifulSoup import BeautifulSoup
3
4 class Element:
5 "A simple container of arbitrary named attributes."
6 def __init__(self, **kw):
7 self.__dict__.update(kw)
8 def __repr__(self):
9 return str(self.__dict__)
10
11 def FetchElements():
12 """Chemical Elements
13
14 Retrieves a list of the basic chemical elements, along with a few of
15 their associated properties.
16 """
17
18 opener = urllib2.build_opener()
19 opener.addheaders = [('User-agent', 'Mozilla/5.0')]
20
21 page = opener.open("http://en.wikipedia.org/wiki/List_of_elements_by_atomic_number")
22 soup = BeautifulSoup(page)
23 page.close()
