]>
jfr.im git - irc/rizon/acid.git/blob - pyva/src/main/python/erepublik/api/war.py
2 from feed
import XmlFeed
5 return War(XmlFeed('http://api.erepublik.com/v1/feeds/war/%d' % int(id)))
10 def __init__(self
, f
):
11 self
.battles
= [{battle
.int('battle-id'): {
12 'loser_id': battle
.int('looser-id'), 'was_secured': battle
.bool('was-secured'),
13 'is_active': battle
.int('is-active'), 'region_id': battle
.int('region-id'),
14 'region': battle
.text('region'), 'battle_link': battle
.text('battle-link'),
15 'winner_id': battle
.int('winner-id')}} for battle
in f
.elements('/war/battles/battle')]
17 self
.fetched_at
= f
.text('/war/info/fetched-at')
18 self
.is_resistance
= f
.text('/war/info/is-for-independence')
19 self
.expires_in
= f
.int('/war/info/expires-in')
20 self
.war_link
= f
.text('/war/info/war-link')
21 self
.created_at
= f
.text('/war/info/created-at') #TODO: date