Exemplo n.º 1
0
    def init(token: str):
        log = Logger.get_instance()

        if not TokenHandler.__initialized:
            log.info('Checking API token: {}...'.format(token))
            if not TokenHandler.__regex.match(token):
                raise BadTokenException(token)
            elif len(token) > 32:
                raise BadTokenException(token)

            TokenHandler.__token = token
            TokenHandler.__initialized = True
            log.info('Legal API Token!')
Exemplo n.º 2
0
from smashggpy.util.Initializer import initialize
token = os.environ['API_TOKEN']

# general imports
from smashggpy.util.Logger import Logger
from smashggpy.util.QueryFactory import QueryFactory
from smashggpy.util.NetworkInterface import NetworkInterface as NI
from smashggpy.util.TokenHandler import TokenHandler
from smashggpy.util.QueryQueueDaemon import QueryQueueDaemon

# initialize
initialize(token)
Logger.set_log_level('info')

# assign logger singleton
log = Logger.get_instance()
log.debug('Env: {}'.format(os.environ))
Logger.get_instance().debug('using token: {}'.format(token))

# send query and get data back

#to12_top8_phase = Phase.get(172834)
#to12_melee = Event.get('tipped-off-12-presented-by-the-lab-gaming-center', 'melee-singles')
#log.info(to12_melee)
"""
sets = to12_melee.get_sets()
for ggset in sets:
	print("{0}: {1} {2} - {3} {4}".format(
		ggset.full_round_text,
		ggset.player1,
		ggset.score1,