예제 #1
0
파일: wotapi.py 프로젝트: Gucioo/whyattend
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
파일: wotapi.py 프로젝트: Gucioo/whyattend
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