#!/usr/bin/env python
"""igcollect - Highwinds CDN

Copyright (c) 2018 InnoGames GmbH
"""

import sys
import json
import grequests

from time import gmtime, strftime, time
from argparse import ArgumentParser

try:
    from urllib.request import Request, urlopen
    from urllib.parse import urlencode
except ImportError:
    from urllib import urlencode
    from urllib2 import Request, urlopen


HIGHWINDS_BASE_URL = 'https://striketracker.highwinds.com/api/v1'
AVG_KEYS = ('xferRateMeanMbps', 'xferRateMbps', 'userXferRateMbps', 'rps',
            'completionRatio')
SUM_KEYS = ('xferUsedTotalMB', 'requestsCountTotal', 'responseSizeMeanMB')
PLATFORMS = ('cds', 'sds', 'cdi', 'sdi')


def parse_args():
    parser = ArgumentParser()
    parser.add_argument('--prefix', default='cdn.highwinds')
    parser.add_argument("-t", "--to", dest="end_time", type=int,
                        help="until when do you want to print the data")