def authorize(self, username, password, hosting_url, *args, **kwargs):
        """Authorize the Review Board Gateway repository.

        Review Board Gateway uses HTTP Basic Auth, so this will store the
        provided password, encrypted, for use in later API requests.

        Similar to GitLab's API, Review Board Gateway will return a private
        token on session authentication.
        """
        try:
            data, headers = self.client.json_post(
                url=hosting_url + '/session',
                username=username,
                password=password)
        except __HOLE__ as e:
            if e.code == 404:
                raise HostingServiceError(
                    ugettext('A Review Board Gateway server was not found at '
                             'the provided URL.'))
            elif e.code == 401:
                raise AuthorizationError(
                    ugettext('The username or password is incorrect.'))
            else:
                logging.warning('Failed authorization at %s: %s',
                                hosting_url + '/session', e, exc_info=1)
                raise

        self.account.data['private_token'] = \
            encrypt_password(data['private_token'])
        self.account.save()
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/hostingsvcs/rbgateway.py/ReviewBoardGateway.authorize