import urllib logging from BeautifulSoup import BeautifulSoup as soup

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import urllib, logging
from BeautifulSoup import BeautifulSoup as soup
from control.models import Member
def info(eid):
url = Member.BASE + str(eid)
logging.debug('Scraping url %s' % url)
html = soup(urllib.urlopen(url).read())
info1 = html.find(None, id='career_tab_content'
).findAll('span', {'class': 'goright special'})
info2 = html.find(None, id='bio_tab_content'
).findAll('span', {'class': 'special'})
data = dict(xp = int(html.find(None, {'class': 'xppoints'}).first().string),
wellness = float(html.find(
None, {'class': 'wellnessvalue tooltip'}).string.strip()),
fights = int(info1[0].string),
damage = int(info1[1].string.split('/')[0].strip()),
manu = float(info2[0].string),
land = float(info2[1].string),
cons = float(info2[2].string),
strength = float(info2[3].string))
return data