3 from feed
import XmlFeed
6 return Company(XmlFeed('http://api.erepublik.com/v2/feeds/companies/%d' % int(id)))
9 return from_id(dict['id'])
12 """A company of eRepublik"""
14 def __init__(self
, f
):
15 self
.id = f
.int('/company/id')
16 self
.name
= f
.text('/company/name')
17 self
.industry
= utils
.get_industry(f
.text('/company/industry/name'))
19 'name': f
.text('/company/country/name'),
20 'id': f
.int('/company/country/id'),
21 'code': f
.text('/company/country/code')}
22 self
.quality
= f
.int('/company/customization-level')
23 self
.is_for_sale
= 'true' in f
.text('/company/is-for-sale')
26 'country': job
.text('country'), 'amount': job
.int('number-of-jobs'),
27 'skill': job
.int('required-skill')}
28 for job
in f
.elements('/company/job-offers/job-offer')]
31 'country': {'name': emp.text('country/name'), 'id': emp.int('country/id'), 'code': emp.text('country/code')}
,
32 'id': emp
.int('id'), 'name': emp
.text('name')}
33 for emp
in f
.elements('/company/employees/employee')]