fpl/models/user.py
def _get_transfer_payload(
            self, players_out, players_in, user_team, players, wildcard,
            free_hit):
        """Returns the payload needed to make the desired transfers."""
        event = 0
        if (self.current_event):
            event = self.current_event
        payload = {
            "confirmed": False,
            "entry": self.id,
            "event": event + 1,
            "transfers": [],
            "wildcard": wildcard,
            "freehit": free_hit
        }

        for player_out_id, player_in_id in zip(players_out, players_in):
            player_out = next(player for player in user_team
                              if player["element"] == player_out_id)
            player_in = next(player for player in players
                             if player["id"] == player_in_id)
            payload["transfers"].append({
                "element_in": player_in["id"],
                "element_out": player_out["element"],
                "purchase_price": player_in["now_cost"],
                "selling_price": player_out["selling_price"]
            })

        return payload
Returns the payload needed to make the desired transfers.
Returns the payload needed to make the desired transfers.
Returns the payload needed to make the desired transfers .
def _get_transfer_payload(
            self, players_out, players_in, user_team, players, wildcard,
            free_hit):
        event = 0
        if (self.current_event):
            event = self.current_event
        payload = {
            "confirmed": False,
            "entry": self.id,
            "event": event + 1,
            "transfers": [],
            "wildcard": wildcard,
            "freehit": free_hit
        }
        for player_out_id, player_in_id in zip(players_out, players_in):
            player_out = next(player for player in user_team
                              if player["element"] == player_out_id)
            player_in = next(player for player in players
                             if player["id"] == player_in_id)
            payload["transfers"].append({
                "element_in": player_in["id"],
                "element_out": player_out["element"],
                "purchase_price": player_in["now_cost"],
                "selling_price": player_out["selling_price"]
            })
        return payload
def _get_transfer_payload ( self , players_out , players_in , user_team , players , wildcard , free_hit ) : event = 0 if ( self . current_event ) : event = self . current_event payload = { "confirmed" : False , "entry" : self . id , "event" : event + 1 , "transfers" : [ ] , "wildcard" : wildcard , "freehit" : free_hit } for player_out_id , player_in_id in zip ( players_out , players_in ) : player_out = next ( player for player in user_team if player [ "element" ] == player_out_id ) player_in = next ( player for player in players if player [ "id" ] == player_in_id ) payload [ "transfers" ] . append ( { "element_in" : player_in [ "id" ] , "element_out" : player_out [ "element" ] , "purchase_price" : player_in [ "now_cost" ] , "selling_price" : player_out [ "selling_price" ] } ) return payload
Returns the payload needed to make the desired transfers.
Returns the payload needed to make the desired transfers .
"""Returns the payload needed to make the desired transfers."""
self
players_out
players_in
user_team
players
wildcard
free_hit