def login(self, ptrt_url):
def auth_check(res):<EOL><INDENT>return ptrt_url in ([h.url for h in res.history] + [res.url])<EOL><DEDENT>session_res = self.session.http.get(<EOL>self.session_url,<EOL>params=dict(ptrt=ptrt_url)<EOL>)<EOL>if auth_check(session_res):<EOL><INDENT>log.debug("<STR_LIT>")<EOL>return True<EOL><DEDENT>http_nonce = self._extract_nonce(session_res)<EOL>res = self.session.http.post(<EOL>self.auth_url,<EOL>params=dict(<EOL>ptrt=ptrt_url,<EOL>nonce=http_nonce<EOL>),<EOL>data=dict(<EOL>jsEnabled=True,<EOL>username=self.get_option("<STR_LIT:username>"),<EOL>password=self.get_option('<STR_LIT:password>'),<EOL>attempts=<NUM_LIT:0><EOL>),<EOL>headers={"<STR_LIT>": self.url})<EOL>return auth_check(res)<EOL>
Create session using BBC ID. See https://www.bbc.co.uk/usingthebbc/account/

:param ptrt_url: The snapback URL to redirect to after successful authentication
:type ptrt_url: string
:return: Whether authentication was successful
:rtype: bool