def add_logged_in_session(self, response=None):
if not response:<EOL><INDENT>response = self.get('<STR_LIT>')<EOL><DEDENT>self._set_session_cookie(response)<EOL>if not self._session_id:<EOL><INDENT>raise AuthenticationFailed('<STR_LIT>')<EOL><DEDENT>response = self.get('<STR_LIT>')<EOL>match = re.search(<EOL>r'<STR_LIT>',<EOL>response.read().decode('<STR_LIT:utf-8>')<EOL>)<EOL>if match:<EOL><INDENT>self._authenticity_token = match.group(<NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>raise AuthenticationFailed('<STR_LIT>')<EOL><DEDENT>
Make the request appear to be coming from a browser

        This is to interact with older parts of Go that doesn't have a
        proper API call to be made. What will be done:

        1. If no response passed in a call to `go/api/pipelines.xml` is
           made to get a valid session
        2. `JSESSIONID` will be populated from this request
        3. A request to `go/pipelines` will be so the
           `authenticity_token` (CSRF) can be extracted. It will then
           silently be injected into `post_args` on any POST calls that
           doesn't start with `go/api` from this point.

        Args:
          response: a :class:`Response` object from a previously successful
            API call. So we won't have to query `go/api/pipelines.xml`
            unnecessarily.

        Raises:
          HTTPError: when the HTTP request fails.
          AuthenticationFailed: when failing to get the `session_id`
            or the `authenticity_token`.