Exemplo n.º 1
0
if prod == "y":
	# Values for MSB
	print "Using Metaswitch League"
	league_no = 597247
	team_no = 10
else:
	# Values for test league
	print "Using TestLeague"
	team_no = raw_input("Which team? [1-4]: ")
	league_no = 697783

# Generate keys for the desired leage / team
team_key = "348.l.%s.t.%s" % (league_no, team_no) 
league_id = "348.l.%s" % league_no

try:
	api = FantasyApi(league_id) 
	api.handler.refresh_token()
except:
	print "Failed to refresh token - register user"
 	FantasyApi.create_handler().reg_user()
	api = FantasyApi(league_id)

try:
	archie = Archibald(api, league_id, team_key)
	archie.start()
except AuthException, e:
	print "Hit API error: %s" % e
	print "Status code: %s" % e.status
Exemplo n.º 2
0
league_id = "348.l.%s" % league_no

api = FantasyApi(league_id)

thing = raw_input("Get new token?: ")
if thing == "true":
    api.handler.reg_user()
else:
    api.handler.refresh_token()

try:

    print "\n%s" % datetime.datetime.now().strftime("%Y-%m-%d %H:%M")

    # Get my team
    print "Getting team"
    myteam = api.get_team(team_key)
    print "Getting empty positions"
    empty = myteam.empty_positions()
    print "Getting benched players"
    benched = myteam.benched_players()
    print "Getting all players"
    players = myteam.players
    p = players[0]

    arch = Archibald(api, league_id, team_key)

except AuthException, e:
    print "Hit API error: %s" % e
    print "Status code: %s" % e.status
Exemplo n.º 3
0
    # Values for testing
    print "Using Test League"
    team_no = raw_input("Which team? [1-4]: ")
    league_no = 697783

# Generate keys for the desired leage / team
team_key = "%s.l.%s.t.%s" % (GAME_KEY, league_no, team_no)
league_id = "%s.l.%s" % (GAME_KEY, league_no)

try:
    api = FantasyApi(league_id)
    api.handler.refresh_token()
except:
    print "Failed to refresh token - register user"
    FantasyApi.create_handler().reg_user()
    api = FantasyApi(league_id)

try:
    archie = Archibald(api, league_id, team_key)

    while True:
        try:
            archie.start()
        except AuthException, e:
            print "Error: %s" % e
            print "Retry in 30 minutes"
            archie.sleep(0, 0, 30)
except AuthException, e:
    print "Hit API error: %s" % e
    print "Status code: %s" % e.status
Exemplo n.º 4
0
	# Values for test league
	print "Using TestLeague"
	team_no = raw_input("Which team? [1-4]: ")
	league_no = 697783

# Generate keys for the desired leage / team
team_key = "348.l.%s.t.%s" % (league_no, team_no) 
league_id = "348.l.%s" % league_no

try:
	api = FantasyApi(league_id) 
	api.handler.refresh_token()
except:
	print "Failed to refresh token - register user"
 	FantasyApi.create_handler().reg_user()
	api = FantasyApi(league_id)

try:
	archie = Archibald(api, league_id, team_key)

	while True:
		try:
			archie.start()
		except AuthException, e:
			print "Error: %s" % e
			print "Retry in 30 minutes"
			archie.sleep(0, 0, 30)
except AuthException, e:
	print "Hit API error: %s" % e
	print "Status code: %s" % e.status
Exemplo n.º 5
0
if prod == "y":
    # Values for MSB
    print "Using Metaswitch League"
    league_no = 597247
    team_no = 10
else:
    # Values for test league
    print "Using TestLeague"
    team_no = raw_input("Which team? [1-4]: ")
    league_no = 697783

# Generate keys for the desired leage / team
team_key = "348.l.%s.t.%s" % (league_no, team_no)
league_id = "348.l.%s" % league_no

try:
    api = FantasyApi(league_id)
    api.handler.refresh_token()
except:
    print "Failed to refresh token - register user"
    FantasyApi.create_handler().reg_user()
    api = FantasyApi(league_id)

try:
    archie = Archibald(api, league_id, team_key)
    archie.start()
except AuthException, e:
    print "Hit API error: %s" % e
    print "Status code: %s" % e.status