<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def login(self, session=None):
 """ Parses app key from betfair exchange site. :param requests.session session: Requests session object """

        session = session or self.client.session
        try:
            response = session.get(self.login_url)
        except ConnectionError:
            raise APIError(None, self.login_url, None, 'ConnectionError')
        except Exception as e:
            raise APIError(None, self.login_url, None, e)
        app_key = re.findall(r'''"appKey":\s"(.*?)"''', response.text)
        if app_key:
            self.app_key = app_key[0]
        else:
            raise RaceCardError("Unable to find appKey")