class Vehicle(API):
def vehicle_stats(self, lang='ru', fields='', account_id=''):
endpoint = '/tanks/stats/'
if type(fields) is list:
fields = self._format_fields(fields)
return self._api_call(endpoint=endpoint, fields=fields, language=lang, account_id=account_id)
def vehicle_achievements(self, lang='ru', fields='', account_id=''):
endpoint = '/tanks/achievements/'
if type(fields) is list:
fields = self._format_fields(fields)
return self._api_call(endpoint=endpoint, fields=fields, language=lang, account_id=account_id)
class Vehicle(API):
def get(self, endpoint='/tanks/stats/', lang='ru', fields='', account_id=''):
if type(fields) is list:
fields = self._format_fields(fields)
return self._api_call(endpoint=endpoint,
fields=fields,
language=lang,
account_id=account_id)
vehicle = Vehicle(...)
stats = vehicle.get()
achievements = vehicle.get('/tanks/achievements/')
class Vehicle(API):
def _call_with_endpoint(self, lang, fields, account_id, endpoint):
if type(fields) is list:
fields = self._format_fields(fields)
return self._api_call(endpoint=endpoint,
fields=fields,
language=lang,
account_id=account_id)
def vehicle_stats(self, lang='ru', fields='', account_id=''):
endpoint = '/tanks/stats/'
return self._call_with_endpoint(lang=lang,
field=fields,
account_id=account_id,
endpoint=endpoint)
def vehicle_achievements(self, lang='ru', fields='', account_id=''):
endpoint = '/tanks/achievements/'
return self._call_with_endpoint(lang=lang,
field=fields,
account_id=account_id,
endpoint=endpoint)
class Vehicle(API):
def vehicle_stats(self, lang='ru', fields='', account_id='', endpoint = '/tanks/stats/'):
if type(fields) is list:
fields = self._format_fields(fields)
return self._api_call(endpoint=endpoint, fields=fields, language=lang, account_id=account_id)
def vehicle_achievements(self, lang='ru', fields='', account_id='', endpoint = '/tanks/achievements/'):
if type(fields) is list:
fields = self._format_fields(fields)
return self._api_call(endpoint=endpoint, fields=fields, language=lang, account_id=account_id