Write data to KINTONE using the Python requests module

flow

  1. Make a container with KINTONE
  2. Send data from Python
  3. I'm happy

KITONE container

This time, I made an app with a field code called "Text1".

Send data from Python

Write the data "abcde".

#!/usr/bin/python
# _*_ coding: utf-8 _*_

import requests


URL = "https://◯◯◯◯.cybozu.com:443" # URL
APP_ID = "APP ID" #kintone app ID
API_TOKEN = "API TOKEN" #kintone API token


class KINTONE:
    def PostToKintone(self, url, appId, apiToken):
        #KINTONE field code: Text1
        record={'Text1':{'value' : 'abcde'}} #Field code and data to write
        data = {'app':appId,'record':record}
        headers = {"X-Cybozu-API-Token": apiToken, "Content-Type" : "application/json"}
        resp=requests.post(url+'/k/v1/record.json',json=data,headers=headers)

        return resp


if __name__ == '__main__':
    knt=KINTONE()
    resp=knt.PostToKintone(URL, APP_ID, API_TOKEN)

    print resp.text

The output is

{"id":"1","revision":"1"}

I felt happy next to me.

Recommended Posts

Write data to KINTONE using the Python requests module
Create a record with attachments in KINTONE using the Python requests module
Try using the Python Cmd module
Log in to Slack using requests in Python
Compress python data and write to sqlite
Just add the python array to the json data
[Python] Let's execute the module regularly using schedule
Write a TCP server using the SocketServer module
The trick to write flatten concisely in python
I tried using the Datetime module by Python
Write CSV data to AWS-S3 with AWS-Lambda + Python
Try using the collections module (ChainMap) of python3
Data cleaning using Python
How to write a GUI using the maya command
How to use the Raspberry Pi relay module Python
I want to write in Python! (3) Utilize the mock
[Introduction to Python] How to stop the loop using break?
[Introduction to Python] How to write repetitive statements using for statements
[Technical book] Introduction to data analysis using Python -1 Chapter Introduction-
[Python] You can save an object to a file by using the pickle module.
Save images using python3 requests
About the Python module venv
Post to Twitter using Python
Start to Selenium using python
Write to csv with Python
Data analysis using python pandas
[Introduction to Python] How to write conditional branches using if statements
[Python] It might be useful to list the data frames
Make the display of Python module exceptions easier to understand
Minimum knowledge to get started with the Python logging module
View using the python module of Nifty Cloud mobile backend
Write a python program to find the editing distance [python] [Levenshtein distance]
Various ways to calculate the similarity between data in python
Build a Python environment and transfer data to the server
Connect to the Bitcoin network using pycoin (Python Cryptocoin Utili)
Solve the Japanese problem when using the CSV module in Python.
What is the default TLS version of the python requests module?
[Python] I tried collecting data using the API of wikipedia
[Python] Introduction to graph creation using coronavirus data [For beginners]
Tweet Now Playing to Twitter using the Spotify API. [Python]
[Introduction to Python] How to get data with the listdir function
Pass OpenCV data from the original C ++ library to Python
How to install python using anaconda
How to write a Python class
[Python] How to FFT mp3 data
Leave the troublesome processing to Python
Retry post request using python requests
How to use the optparse module
Data acquisition using python googlemap api
[Python] Write to csv file with Python
I tried using the python module Kwant for quantum transport calculation
How to use Requests (Python Library)
The 15th offline real-time how to write reference problem in Python
How to get followers and followers from python using the Mastodon API
Get the weather with Python requests
First python ② Try to write code while examining the features of python
Get the weather with Python requests 2
In the python command python points to python3.8
How to get the Python version
Operate Maya from an external Python interpreter using the rpyc module
Try to analyze online family mahjong using Python (PART 1: Take DATA)