fpl/fpl.py
async def login(self, email=None, password=None):
        """Returns a requests session with FPL login authentication.

        :param string email: Email address for the user's Fantasy Premier
            League account.
        :param string password: Password for the user's Fantasy Premier League
            account.
        """
        if not email and not password:
            email = os.getenv("FPL_EMAIL", None)
            password = os.getenv("FPL_PASSWORD", None)
        if not email or not password:
            raise ValueError("Email and password must be set")

        payload = {
            "login": email,
            "password": password,
            "app": "plfpl-web",
            "redirect_uri": "https://fantasy.premierleague.com/a/login"
        }

        login_url = "https://users.premierleague.com/accounts/login/"
        async with self.session.post(login_url, data=payload,
                                     ssl=ssl_context) as response:
            state = response.url.query["state"]
            if state == "fail":
                reason = response.url.query["reason"]
                raise ValueError(f"Login not successful, reason: {reason}")
Returns a requests session with FPL login authentication.

        :param string email: Email address for the user's Fantasy Premier
            League account.
        :param string password: Password for the user's Fantasy Premier League
            account.
        
Returns a requests session with FPL login authentication.
Returns a requests session with FPL login authentication .
async def login(self, email=None, password=None):
        if not email and not password:
            email = os.getenv("FPL_EMAIL", None)
            password = os.getenv("FPL_PASSWORD", None)
        if not email or not password:
            raise ValueError("Email and password must be set")
        payload = {
            "login": email,
            "password": password,
            "app": "plfpl-web",
            "redirect_uri": "https://fantasy.premierleague.com/a/login"
        }
        login_url = "https://users.premierleague.com/accounts/login/"
        async with self.session.post(login_url, data=payload,
                                     ssl=ssl_context) as response:
            state = response.url.query["state"]
            if state == "fail":
                reason = response.url.query["reason"]
                raise ValueError(f"Login not successful, reason: {reason}")
async def login ( self , email = None , password = None ) : if not email and not password : email = os . getenv ( "FPL_EMAIL" , None ) password = os . getenv ( "FPL_PASSWORD" , None ) if not email or not password : raise ValueError ( "Email and password must be set" ) payload = { "login" : email , "password" : password , "app" : "plfpl-web" , "redirect_uri" : "https://fantasy.premierleague.com/a/login" } login_url = "https://users.premierleague.com/accounts/login/" async with self . session . post ( login_url , data = payload , ssl = ssl_context ) as response : state = response . url . query [ "state" ] if state == "fail" : reason = response . url . query [ "reason" ] raise ValueError ( f"Login not successful, reason: {reason}" )
Returns a requests session with FPL login authentication.
Returns a requests session with FPL login authentication .
"""Returns a requests session with FPL login authentication.

        :param string email: Email address for the user's Fantasy Premier
            League account.
        :param string password: Password for the user's Fantasy Premier League
            account.
        """
self
email
Email address for the user's Fantasy Premier
League account.
Email address for the user ' s Fantasy Premier League account .
password
Password for the user's Fantasy Premier League
account.
Password for the user ' s Fantasy Premier League account .