]>
jfr.im git - irc/rizon/acid.git/blob - pyva/src/main/python/erepublik/api/country.py
2 from feed
import XmlFeed
, get_json
6 def get_cached_countries():
9 if country_feed
== None:
10 country_feed
= XmlFeed('http://api.erepublik.com/v2/feeds/countries/')
15 return get_json('http://api.1way.it/erep/country/%d' % int(id))
18 country_feed
= get_cached_countries()
20 countries
= country_feed
.elements('/countries/country')
24 if name
== c
.text('name').lower() or name
== c
.text('code').lower():
25 return from_id(c
.text('id/text()'))
30 return from_id(dict['id'])
32 def get_taxes(country_id
):
33 return get_json('http://api.1way.it/erep/tax/%d' % country_id
)
35 def get_regions(country_id
):
36 return get_json('http://api.1way.it/erep/regions/%d' % country_id
)