Image Attachment in python SDK

n1ql

#1

Hi all,
I have the below document which got synced from couchbase lite (iOS).
{ "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" }

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.

Thanks


#2

You can use the GET /{db}/{doc}/{attachment} endpoint on Sync Gateway http://developer.couchbase.com/documentation/mobile/1.3/develop/references/sync-gateway/rest-api/index.html#operation---db---doc---attachment--get to render the image in an <img />.
I read python SDK in the title of the question. Are you referring to the Python SDK for Couchbase Server or an HTTP client for the Sync Gateway REST API ?

James