To use quip client, we copy the quip.py file from https://github.com/quip/quip-api/blob/master/python/quip.py to our project.
Since new_document
didn't have the advertised type
argument, I ended up editing the copy of quip.py to include the additional argument. Here is the diff
--- a/quip.py
+++ b/quip.py
@@ -300,7 +300,7 @@ class QuipClient(object):
"member_ids": ",".join(member_ids),
})
- def new_document(self, content, format="html", title=None, member_ids=[]):
+ def new_document(self, content, format="html", title=None, member_ids=[], doc_type="document"):
"""Creates a new document from the given content.
To create a document in a folder, include the folder ID in the list
@@ -310,16 +310,18 @@ class QuipClient(object):
user = client.get_authenticated_user()
client.new_document(..., member_ids=[user["archive_folder_id"]])
+ doc_type is one of document or spreadsheet.
"""
return self._fetch_json("threads/new-document", post_data={
"content": content,
"format": format,
"title": title,
"member_ids": ",".join(member_ids),
+ "type": doc_type
})
def copy_document(self, thread_id, folder_ids=None, member_ids=None,