@gen.coroutine
    def get_attachment(self, doc, attachment_name, mimetype=None):
        if '_id' not in doc:
            raise ValueError('Missing key named _id in doc')
        if not mimetype:
            # get mimetype from the doc
            if '_attachments' not in doc:
                raise ValueError('No attachments in doc, cannot get content'
                                 ' type of attachment')
            elif attachment_name not in doc['_attachments']:
                raise ValueError('Document does not have an attachment by'
                                 ' the given name')
            else:
                mimetype = doc['_attachments'][attachment_name]['content_type']
        url = '{0}/{1}/{2}'.format(self.db_name, url_escape(doc['_id']),
                                   url_escape(attachment_name))
        headers = {'Accept': mimetype}
        r = yield self._http_get(url, headers=headers)
        raise gen.Return(r)
Get document attachment.
dataset/ETHPy150Open nephics/tornado-couchdb/couch/couch.py/AsyncCouch.get_attachment