示例#1
0
def get_provinces(clan_id):
    r = requests.get('http://worldoftanks.' + WOT_SERVER_REGION_CODE.lower() +
                     '/community/clans/' + str(clan_id) + '/provinces/list/',
                     params={'id': 'js-provinces-table'},
                     headers={'X-Requested-With': 'XMLHttpRequest',
                              'Accept': 'application/json, text/javascript, text/html, */*'},
                     timeout=API_REQUEST_TIMEOUT)
    if r.ok:
        return r.json()
示例#2
0
def get_scheduled_battles(clan_id):
    try:
        r = requests.get('http://worldoftanks.' + WOT_SERVER_REGION_CODE.lower() +
                         '/community/clans/' + str(clan_id) + '/battles/list/',
                         params={'id': 'js-battles-table'},
                         headers={'X-Requested-With': 'XMLHttpRequest',
                                  'Accept': 'application/json, text/javascript, text/html, */*'},
                         timeout=API_REQUEST_TIMEOUT)
        if r.ok and r.json()['result'] == 'success':
            return r.json()
        else:
            return None
    except Exception:
        return None