def post_session(self, session, notify=False):
        job = session.job
        status = job.status()
        if session.name:
            title = "{0}: Job ID {1} {2}".format(session.name, session.job_id, status)
        else:
            title = "Job ID {0} {1}".format(session.job_id, status)
        params = {
            'style': 'application',
            'format': 'medium',
            'title': title,
            'url': job.url,
            # the first line of query
            'description': job.query.split('\n')[0],
        }
        # author
        if self.author:
            digest = hashlib.md5(self.author.encode('ascii')).hexdigest()
            params['icon'] = {'url': 'http://www.gravatar.com/avatar/' + digest}
        attributes = []
        # duration
        if session.job_start_at:
            job_duration = session.job_end_at - session.job_start_at
            attributes.append({
                'label': 'Job Start',
                'value': {'label': str(session.job_start_at), 'style': 'lozenge'},
            })
            attributes.append({
                'label': 'Duration',
                'value': {'label': str(job_duration), 'style': 'lozenge'},
            })
        # download
        if session.download_start_at and session.download_end_at:
            download_duration = session.download_end_at - session.download_start_at
            attributes.append({
                'label': 'Download Start',
                'value': {'label': str(session.download_start_at), 'style': 'lozenge'},
            })
            attributes.append({
                'label': 'Duration',
                'value': {'label': str(download_duration), 'style': 'lozenge'},
            })
        # attributes
        params['attributes'] = attributes
        if status == 'running':
            color = 'yellow'
        elif status == 'success':
            color = 'green'
        else:
            color = 'red'
            params['description'] = job.debug['stderr']
        self.post(params['title'], card=params, color=color)
dataset/ETHPy150Open treasure-data/pandas-td/pandas_td/drivers/hipchat.py/HipChatNotifier.post_session/original