Image Attachment in python SDK
<p>I have the below document which got synced from couchbase lite (iOS).</p>

<pre><code>        {

        "Date": "00170925591601",
        "ID": "tmp652844",
        "InvoiceNumber": "tmp652844",
        "Supplier": "Temp",
        "_attachments": {
                        "ImageAttachment": {
                                            "content_type": "image/jpeg",
                                            "digest": "sha1-8uKi9mywFwvoP8qNrTGEMWemgKU=",
                                            "length": 1898952,
                                            "revpos": 2,
                                            "stub": true
                                            }
                        },
        "channels": [
                     "payment"
                    ],
        "type": "invoice"
       }
</code></pre>

<p>How do I get the attachment from the document? I need to render the image attachment in the HTML. I believe the above attachment data is only meta data.
It would be of great help if someone can help me with this.</p>

<p>Thanks</p>

<p>use the function ..</p>

<p>get_attachment(id_or_doc, filename, default=None)
Return an attachment from the specified doc id and filename.</p>

<p>Parameters: 
id_or_doc â either a document ID or a dictionary or Document object representing the document that the attachment belongs to
filename â the name of the attachment file
default â default value to return when the document or attachment is not found
Returns:<br>
a file-like object with read and close methods, or the value of the default argument if the attachment is not found
Since:<br>
0.4.1</p>

<p>check <a href="https://pythonhosted.org/CouchDB/client.html#couchdb.client.Database.get_attachment" rel="nofollow">https://pythonhosted.org/CouchDB/client.html#couchdb.client.Database.get_attachment</a> for more details</p>

python couchbase