Giter Site home page Giter Site logo

quip-api's People

Contributors

caseymrm avatar craink avatar dacut avatar dengzb avatar emerdan avatar finiteloop avatar handlerbot avatar jrnold avatar kenichi-ando avatar kwent avatar lllllllllllllllllllllllllllllllllllllll avatar mihaip avatar mmartinson avatar plinehan avatar willhite avatar zimuw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

quip-api's Issues

Better documentation for node.js library

It would be very helpful to have better documentation so one knows when options are changed from the api. For instance getting recent threads with the parameter max_updated_usec changes absolutely nothing because the library maps it from maxUpdatedUsec.

Request: move folders

It'd be great to have a way to move a folder into a different folder like we can via UI. Currently we can only create a new folder but there's no way to remove a folder, so we can't even simulate moving a folder via create folder/move content/delete old folder.

Granular user permissions

Hi there is there a granular method of defining document editability? My use-case would ideally allow a user to edit the styling of a spreadsheet but not the cell value.

Can we edit "quip.apps.auth()".

Can we check quip.apps.auth("drive") methods inside quip.apps.auth(). If any of the ways can get this method inside our project direct kindly share, please.

Anybuddy knows methods inside auth() method. because when we get the console it nothing comes in the understandable form.

errors on baqup

This issue may be inconsistent or due to other problems as the concerned folder was imported from Evernote.
Anyway, I called main like this:
baqup/main.py --access_token "ABCDEF1GH2abcdd=e123456789f0/g1hilmIJKLMNm2n3oOpqrPQstu45Rvwx6STU78VWX=" --root_folder_id AbCDEFgHHIl --output_directory my_backup
The first six thread were backed up
INFO:root:Backing up folder my_quip_folder_0...
INFO:root: Backing up thread Report XANTOS (OOfAAAANU4B)...
INFO:root: Backing up thread Workgroup (HWTAAASVKEL)...
INFO:root: Backing up thread Acronyms (NIaAAAlbMii)...
INFO:root: Backing up thread tricks for ZOTS (KaJAAAMKxPv)...
INFO:root: Backing up thread zots for tricks (dENAAApyH59)...
INFO:root: Backing up thread Z8080 chemin a parcourir (CVAAAAmJ4H6)...
INFO:root: Backing up thread Z8080 pre-verification (VYWAAAVhT5Y)...
Traceback (most recent call last):
File "baqup/main.py", line 256, in <module>
main()
File "baqup/main.py", line 68, in main
_run_backup(client, output_directory, args.root_folder_id)
File "baqup/main.py", line 75, in _run_backup
client, output_directory, 0)
File "baqup/main.py", line 118, in _descend_into_folder
_backup_thread(thread, client, folder_output_path, depth + 1)
File "baqup/main.py", line 128, in _backup_thread
tree = client.parse_document_html(thread["html"])
File "/home/myuser/quip/quip-api-master/samples/baqup/quip.py", line 574, in parse_document_html
return xml.etree.cElementTree.fromstring(document_xml.encode("utf-8"))
File "<string>", line 124, in XML
cElementTree.ParseError: mismatched tag: line 127, column 346
Access token, file IDs and document names were changed.
It seems there was a problem in parsing XML. Could it be a wrong utf-8 character or something of the like?

Last edit time

Hi,

Is there any way that I can get baqup to include the time/date of the last edit? Needed to make a quip -> hugo publishing suite.

Bug in the `baqup` script

When I run the script, this following line throws an exception.

title = folder["folder"]["title"]

I found that the reason is the folder["folder"] does not have key "title"

Spreadsheet anchor links

I create a document, get its id then create a new table in my spreadsheet and get its id. This all works fine.

Now i want a cell in my table to link to another sheet in the same document so I manually create an anchor link in one of the cells

https://quip.com/docid#sectionid

somehow quip does some url verification or something on the back-end and

  1. gives me a 403 if the doc id in the url doesn't exist
  2. if it links to a section in the existing doc, quip sets the cell contents to something like
    <span id='s:CSa9CACFXV2_CSa9CAAOwhk'><control data-remapped="true" id="CSa9CA8EPS7"><a href="/CSa9AArUUag"></a></control></span>

completely messing up the <a> element and my quip link. I am expecting:
<a href="https://quip.com/CSa9AArUUag#CSa9CAKkw3N">link test</a>

What is quip doing to my urls???

Search API

Hello,

Search API does not officially exist at https://quip.com/api/reference

Would be nice if you could open an endpoint to perform searches like /search?query=xxxx and return a list of documents with their associated id as the website does.

Regards,

installation

Hey I don't see any installation instructions for node, etc.

Mac, python

Can't update spreadsheet sections

I get this error whenever trying to edit a spreadsheet, with any operation and section:

This document does not support updates with the given location type and section_id.

so section_id param is unused in edit_document for spreadsheets.

RIP

Multiple problems since (caused by?) quip update to 5.3.73

Using the python library:

Before quip updated to 5.3.73, the following used to append this table to a quip doc. It took a few seconds:

html='<styletype="text/css"></style><tableid="T_448afd06_bcea_11e8_ad66_85db738ef211"><thead><tr><thclass="blanklevel0"></th><thclass="col_headinglevel0col0">0</th><thclass="col_headinglevel0col1">1</th><thclass="col_headinglevel0col2">2</th><thclass="col_headinglevel0col3">3</th></tr></thead><tbody><tr><thid="T_448afd06_bcea_11e8_ad66_85db738ef211level0_row0"class="row_headinglevel0row0">0</th><tdid="T_448afd06_bcea_11e8_ad66_85db738ef211row0_col0"class="datarow0col0">0.473966</td><tdid="T_448afd06_bcea_11e8_ad66_85db738ef211row0_col1"class="datarow0col1">0.699742</td><tdid="T_448afd06_bcea_11e8_ad66_85db738ef211row0_col2"class="datarow0col2">0.613732</td><tdid="T_448afd06_bcea_11e8_ad66_85db738ef211row0_col3"class="datarow0col3">0.00509206</td></tr><tr><thid="T_448afd06_bcea_11e8_ad66_85db738ef211level0_row1"class="row_headinglevel0row1">1</th><tdid="T_448afd06_bcea_11e8_ad66_85db738ef211row1_col0"class="datarow1col0">0.401876</td><tdid="T_448afd06_bcea_11e8_ad66_85db738ef211row1_col1"class="datarow1col1">0.847217</td><tdid="T_448afd06_bcea_11e8_ad66_85db738ef211row1_col2"class="datarow1col2">0.565785</td><tdid="T_448afd06_bcea_11e8_ad66_85db738ef211row1_col3"class="datarow1col3">0.335244</td></tr><tr><thid="T_448afd06_bcea_11e8_ad66_85db738ef211level0_row2"class="row_headinglevel0row2">2</th><tdid="T_448afd06_bcea_11e8_ad66_85db738ef211row2_col0"class="datarow2col0">0.731451</td><tdid="T_448afd06_bcea_11e8_ad66_85db738ef211row2_col1"class="datarow2col1">0.15366</td><tdid="T_448afd06_bcea_11e8_ad66_85db738ef211row2_col2"class="datarow2col2">0.196025</td><tdid="T_448afd06_bcea_11e8_ad66_85db738ef211row2_col3"class="datarow2col3">0.952313</td></tr><tr><thid="T_448afd06_bcea_11e8_ad66_85db738ef211level0_row3"class="row_headinglevel0row3">3</th><tdid="T_448afd06_bcea_11e8_ad66_85db738ef211row3_col0"class="datarow3col0">0.88194</td><tdid="T_448afd06_bcea_11e8_ad66_85db738ef211row3_col1"class="datarow3col1">0.433064</td><tdid="T_448afd06_bcea_11e8_ad66_85db738ef211row3_col2"class="datarow3col2">0.702595</td><tdid="T_448afd06_bcea_11e8_ad66_85db738ef211row3_col3"class="datarow3col3">0.774665</td></tr></tbody></table>'
client = quip.QuipClient(token)
client.edit_document(thread, html)

Now the same code will put a blank spreadsheet in the quip doc, which remains grey and with no cells populated. A blue progress bar / wait indicator moves from left to right across the top of the spreadsheet, indefinitely. If I exit the document and return to it, the table is updated when I return.

Secondly, after posting a table in this manner, an additional edit_document() call will prepend the new content, instead of appending it.

Set color in new_message()

Hi,
I'm using using Python API to write a simple command line client to send alerts from my monitoring system to a chat room, but I can't find a way to set the color for the message (eg. red for errors, yellow for warning, blu for info, etc.).
Can you help me?

Marco

Title not changing

When I edit the first line of my document using the API, the page's title doesn't change. The text will change, but the name that displays in search and in @mentions is the same as it was original. In order to get the title to update, I can do so by manually opening the document, and adding and deleting a space in the updated H1.

Append new line to sheet

How can I add a line to the next free/empty line in a spreadsheet?

screenshot 2018-03-02 21 52 32

Cant get it to work. help appreciated. thx.

Quip in Pip

I'm working on a quip integration and noticed that the python client isn't in PyPi, which was weird since the NodeJS version is in NPM.

I was wondering if this was an active decision / if it would be possible for your company to submit the client. It'd be especially nice if it was added as "quipclient" (it would just pair nicely with Slack's slackclient, and "quip" is already taken).

Link for pypi/pip: https://pypi.org/project/pip/

baqup - AttributeError: 'long' object has no attribute 'encode'

I got the following error when running python main.py --access_token="..." --output_directory=output in samples/baqup

INFO:root:Looking for conversations
INFO:root:  Got 0 threads, paged back to 2017-03-04T02:31:39.894535
Traceback (most recent call last):
  File "main.py", line 272, in <module>
    main()
  File "main.py", line 73, in main
    _run_backup(client, output_directory, args.root_folder_id)
  File "main.py", line 87, in _run_backup
    conversation_threads = _get_conversation_threads(client)
  File "main.py", line 212, in _get_conversation_threads
    max_updated_usec=max_updated_usec, count=50).values()
  File "C:\data\dev\python\quip-api\samples\baqup\quip.py", line 225, in get_recent_threads
    count=count)
  File "C:\data\dev\python\quip-api\samples\baqup\quip.py", line 682, in _fetch_json
    request = Request(url=self._url(path, **args))
  File "C:\data\dev\python\quip-api\samples\baqup\quip.py", line 718, in _url
    args = self._clean(**args)
  File "C:\data\dev\python\quip-api\samples\baqup\quip.py", line 713, in _clean
    for k, v in args.items() if v or isinstance(
  File "C:\data\dev\python\quip-api\samples\baqup\quip.py", line 714, in <genexpr>
    v, (int, float, complex)))
AttributeError: 'long' object has no attribute 'encode'

Cannot use update_spreadsheet_row

It seems that the return value of API has been changed and update_spreadsheet_row() can not be used from 19/03/2019. This error occurs by this line.
I tentatively changed to removed from the row_tree those that do not have an id

Cannot specify spreadsheet header width

Fetching the html of a spreadsheet thread reveals something like this for the headers:

<tr>
    <th class='empty' style='width: 2em' />
    <th id='XZc9CAgWGib' style='width: 23em'><span id='XZc9CAgWGib'>Col A</span>

        <br /></th>
    <th id='XZc9CAPxiQ6' style='width: 19em'><span id='XZc9CAPxiQ6'>Col B</span>
        <br /></th>
</tr>

But when I do edit_document and specify style='width: 20em somewhere in my content, it is ignored. It defaults to 6em and can only be updated manually on the sheet, it is ignored in edit_document. Does the styling get stripped?

'baqup' consistently fails due to 503: Over Rate Limit

Traceback (most recent call last):
  File "main.py", line 272, in <module>
    main()
  File "main.py", line 73, in main
    _run_backup(client, output_directory, args.root_folder_id)
  File "main.py", line 83, in _run_backup
    client, output_directory, 0)
  File "main.py", line 120, in _descend_into_folder
    client, folder_output_path, depth + 1)
  File "main.py", line 120, in _descend_into_folder
    client, folder_output_path, depth + 1)
  File "main.py", line 122, in _descend_into_folder
    thread = client.get_thread(child["thread_id"])
  File "/Users/nrser/dev/gh/quip/quip-api/samples/baqup/quip.py", line 247, in get_thread
    return self._fetch_json("threads/" + id)
  File "/Users/nrser/dev/gh/quip/quip-api/samples/baqup/quip.py", line 788, in _fetch_json
    raise QuipError(error.code, message, error)
quip.QuipError: 503: Over Rate Limit

I went in and added retry with multiplicative back-off up to about five minutes total... it still can't make it through. Sometimes it gets in a state where it can't even start up, just 503: Over Rate Limit again and again on every request.

We realized that we have a ton of very important notes in Quip, and really need to back them up. Probably have somewhere between hundreds to low thousands of docs.

What's the deal?

I'm on Python 2.7.14, MacOS 10.12.6 if it makes any difference.

Get list of folders and threads

Hi,

Is it possible to get list of all accessible folders or threads?
I only found get folder/thread by ID. But to call that we need to know the ID, don't we?

Feature Request: Capability to copy documents between folders using the API

My company has a set of document templates that we store in Quip, 24 documents currently. When we bring on a new customer, we create a customer folder and copy the documents from the template folder to the newly created customer folder manually. This requires quite a bit of manual work because for each file you have to select the file, select copy, then drill down several levels of folder hierarchy to find the destination customer folder. It would be extremely useful if there was a way to copy documents from one folder to another using the API.

Unable to access a specific sheet in a quip spreadsheet

Using node.js it seems that we are unable to request a specific sheet in a given spreadsheet (thread). No matter what I try i either get the initial sheet or an error. Is this intended or is there a way to identify a specific sheet?

client.getThread(, function(err, tr){
//Do stuff here
})

Cannot update first column of spreadsheet

Hello,
When using update_spreadsheet_row() in the python API, I think there's a problem if you want to update the first column value with index = 0:
This line will indeed evaluate to True because not index == True and therefore the update will not happen.
I think we should call get_index_of_header() with default=None and then us index is not None instead of not index as in this line

Headers messed up in update_spreadsheet_row

The headers are messed up in update_spreadsheet_row, there is one None at the beginning but there shouldn't be.
Occurs at this line

I hacked it like this for now:

headers = self.get_spreadsheet_header_items(spreadsheet)
if headers[0] is None:
    headers = headers[1:]

demo code in python api fails

In commit 12254a4, line 394 of quip.py replaces semicolons with underscores in the section_id, but this fails when no section_id is specified (as in the demo example) because by default, section_id=None.
screen shot 2018-07-29 at 5 18 33 pm

Export to CSV/Excel via API

Hello,

from what I read this is not possible currently on the API, but it's badly needed in an enterprise environment where people use Excel all day long.

I find Quip excellent for having teams editing simultaneously a spreadsheet (we moved to Quip as we kept hitting permission issues on Excel), but I then need the Excel version to integrate with other workflows.

Any chance to get this feature in the API? I saw a similar request on Markdown...

getRecentThreads `max_updated_usec` not being respected

I'm returning threads with updated_usec greater than the the max_updated_usec value.

class Pager {
    static getRecentThreadsPaged(client, callback, usec) {
        if (usec == 'now') {
            usec = Number.MAX_SAFE_INTEGER
        }
        console.log('Getting recent threads paged before '+usec);
        client.getRecentThreads({
            count: 2,
            maxUpdatedUsec: usec
        },function (err, threads) {
            var count = 0
            var original_usec = usec
            for (var key in threads) {
                var thread = threads[key]
                if (thread.thread.updated_usec > original_usec) {
                    console.log('THREAD SHOULD NOT BE HERE '+thread.thread.title+' '+thread.thread.updated_usec+' is greater than '+original_usec)
                } else {
                    usec = Math.min(thread.thread.updated_usec, usec)
                    callback(thread, key)
                }
                count++;
            }
            if (count == 2) {
                this.getRecentThreadsPaged(client, callback, usec - 1 )
            }
        }.bind(this))
    }

Any ideas why it would be returning threads that were after the max usec?

editDocument: Add mention to document.

I've tried giving the html back in the exact same format <control><a href="http://.../userId"></a></control> however that seems to get complete striped out and creates a link to nowhere. Whats the proper way for creating a mention in html format.

URLError: <urlopen error [Errno 8] _ssl.c:529: EOF occurred in violation of protocol>

File "/base/data/home/apps/sxxxx/xxxx/libs/quip.py", line 180, in get_thread
return self._fetch_json("threads/" + id)
File "/base/data/home/apps/s
xxxx/xxxx/libs/quip.py", line 651, in _fetch_json
urllib2.urlopen(request, timeout=self.request_timeout).read())
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 404, in open
response = self._open(req, data)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 422, in _open
'_open', req)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 1222, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 1184, in do_open
raise URLError(err)
URLError: <urlopen error [Errno 8] _ssl.c:529: EOF occurred in violation of protocol>

Please help with this error.

editDocument: documentation for adding check list items.

How would I go about adding a check list item with either a checked or unchecked state? I've tried:

<div data-section-style="7"><ul><li class="">Incomplete...</li><li class="checked">Complete!</li></ul></div>

The section style make it a check list but the class checked or not (which is how I receive it when I get the document) doesn't make a difference.

Is quip python lib still active ?

client = quip.QuipClient(access_token="...")
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'QuipClient'

Restoring from `baqup` script - extra title is added

When I try to restore documents that were generated with the baqup script I'm using the new_document method from the Python client.

But the document that is created is being added a title with no heading format in the beginning although it's not in the backed up html file. The result is two "titles" one small without header markup, and beneath it, the original H1 title.

How can I create a document with the API that does not add an extra title?

Thanks

Coping documents strips all formatting info

I'm trying to copy spreadsheet using both raw API and Python lib but it seems that all formatting info like column width and font weight is stripped from the newly created thread. Is there any way to preserve the formatting?

python client.edit_document failing with any operation requiring section_id

For html:

u"<h1 id='MZNACACqNMj'>Test</h1>\n\n<p id='MZNACAJjo49' class='line'>test</p>\n\n<p id='MZNACAevQlK' class='line'>\u200b</p>\n\n"

client.edit_document(quip_document, '<p>new text</p>', operation=4, section_id=MZNACAJjo49)

is failing with:
quip.QuipError: 400: This document does not support updates with the given location type and section_id.

same with any other operation that requires section_id

edit_document() is hardcoded to APPEND as operation - cannot use any other location type

quip-api/python/quip.py

Lines 402 to 424 in cfa97b9

def edit_document(self, thread_id, content, operation=APPEND, format="html",
section_id=None, **kwargs):
"""Edits the given document, adding the given content.
`operation` should be one of the constants described above. If
`operation` is relative to another section of the document, you must
also specify the `section_id`.
"""
# Since our cell ids in 10x contain ';', which is a valid cgi
# parameter separator, we are replacing them with '_' in 10x cell
# sections. This should be no op for all other sections.
section_id = None if not section_id else section_id.replace(";", "_")
args = {
"thread_id": thread_id,
"content": content,
"location": operation,
"format": format,
"section_id": section_id
}
args.update(kwargs)
return self._fetch_json("threads/edit-document", post_data=args)

Error: Only one section allowed for replacement

When calling editDocument with operation REPLACE_SECTION I get this error consistently. I'm only trying to replace one section, however I want to replace all the content within that section. Is this not the expected use case? Can I change the contents of an entire section without deleting and a new one in the same place in the document? Perhaps this is a by-product of the issue but I have a lot of orphaned sections when I inspect the document.

{ 
  "threadId": "WabAAARi2ls",
  "operation": 4,
  "sectionId": "WabACApQqhG",
  "content": "'<li>List item A</li><li>List item B</li><li>List item C</li><li>List item D</li><li>List Item E</li>' 
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.