def authorize(self, username, password, hosting_url, *args, **kwargs):
        try:
            data, headers = self.client.json_post(
                url=hosting_url + '/session',
                username=username,
                password=password)
        except HTTPError 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()
Authorize the Review Board Gateway repository.
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/hostingsvcs/rbgateway.py/ReviewBoardGateway.authorize