Is it possible to upload an audio file using the Quip API?
I see in the documentation the API supports the upload of blob objects. I can't seem to get this to work properly.
I have tried uploading both audio and images to no avil. From what I have read online, you first use the put_blob
function to upload the blob- this returns the id
and url
of the blob. Then use the edit_document
function to add the blob url to the document ('thread' in quip terminology).
Running the code below does seem to upload the blob, however it is always in plain text format. When adding the blob url to the document- it shows up as a text string /blob/{thread id}/{blob id}
and not the actual file. This makes me think that Quip is not able to parse the blob- perhaps because of formatting?
My hope to it emulate the 'insert file' feature of Quip via the API.
What am I doing wrong here? Some code examples in python would be extremely appreciated.
file_path = #path to audio file
with open(file_path, 'rb') as f:
audio = f.read()
client = quip.QuipClient(access_token=ACCESS_TOKEN)
audio_blob = client.put_blob(thread_id, audio, name='Test_file')
client.edit_document(thread_id, audio_blob['url'], client.APPEND, 'html')
edit document
adds a plain text string- /blob/{thread id}/{blob id}, and not the actual file. I can download the blob using the url, but again it is always a plain text file