[PYTHON] I tried to create Quip API

Introduction

I accessed a specific document in Quip with the Quip API to parse the text stored in Sheets on Quip. Make a note of the access method at that time for personal use.

Get Access Token

Get Token with POSTMAN. For more information, see Quip API Documentation (https://quip.com/dev/automation/documentation)


GET https://platform.quip.com/1/users/current

Actually access

Get folders and documents using the function to get the spreadsheet on Github.

quip_analysis.py



import quip

# access to the quip
client = quip.QuipClient(access_token=<access_token>)

# Get your thread_id from the URL of your document
user = client.get_authenticated_user()
starred = client.get_folder(user["starred_folder_id"])

# get the spreadsheet
spreadsheet = client.get_second_spreadsheet(thread_id=<thread_id>)
parsedSpreadsheet = client.parse_spreadsheet_contents(spreadsheet)

Since you can get the data in spread format, drop it in the data frame

quip_analysis.py


# create the dataframe
    counter = 0
    spreadsheetData = []
    colNames = []

    for rows in parsedSpreadsheet["rows"]:
        cells = rows["cells"]
        rowData = []
        for key, value in cells.items():
            if counter == 0:
                colNames.append(key)
            rowData.append(value['content'])
        spreadsheetData.append(rowData)
        counter += 1   
    l = pd.DataFrame(spreadsheetData, columns=colNames)

After that, frequent words on the document were extracted by morphological analysis.

Recommended Posts

I tried to create Quip API
I tried to touch Tesla's API
I tried to create API list.csv in Python from swagger.yaml
I tried to create a linebot (implementation)
I tried to create a linebot (preparation)
I tried to touch the COTOHA API
I tried to make a Web API
I tried to debug.
I tried to paste
I tried to touch the API of ebay
I tried to learn PredNet
I tried to organize SVM.
I tried to implement PCANet
I tried to reintroduce Linux
I tried to introduce Pylint
I tried to summarize SparseMatrix
I tried to touch jupyter
I tried to implement StarGAN (1)
I tried to create a table only with Django
I tried to uncover our darkness with Chatwork API
I tried to implement Deep VQE
[First COTOHA API] I tried to summarize the old story
I tried the Naro novel API 2
I tried to touch Python (installation)
I tried to automatically create a report with Markov chain
I tried to implement adversarial validation
I tried to explain Pytorch dataset
I tried Watson Speech to Text
I tried to implement hierarchical clustering
I tried to organize about MCMC.
I tried the Naruro novel API
I tried to create a bot for PES event notification
I tried to implement Realness GAN
I tried to get various information from the codeforces API
I tried to move the ball
[Python] Create API to send Gmail
I tried using the checkio API
I tried to estimate the interval.
I tried to create an article in Wiki.js with SQLAlchemy
I tried to create a RESTful API by connecting the explosive Python framework FastAPI to MySQL.
I tried to create a server environment that runs on Windows 10
I tried to create an environment of MkDocs on Amazon Linux
I tried to create a simple credit score by logistic regression.
I tried to create a list of prime numbers with python
I tried to analyze my favorite singer (SHISHAMO) using Spotify API
I tried to create Bulls and Cows with a shell program
[Python] I tried to get various information using YouTube Data API!
I tried to summarize Python exception handling
I tried to implement PLSA in Python
I tried using Azure Speech to Text.
I tried using Twitter api and Line api
I tried to implement Autoencoder with TensorFlow
I tried to summarize the umask command
I tried to implement permutation in Python
I tried to visualize AutoEncoder with TensorFlow
I tried to recognize the wake word
I tried to get started with Hy
I tried using YOUTUBE Data API V3
I tried to implement PLSA in Python 2
Python3 standard input I tried to summarize
I tried to classify text using TensorFlow