pykintone on Windows Subsystem for Linux worked, so I tried pykintone with Docker next.
pykintone: Python library for kintone
All you have to do is install pykintone with pip. Very easy.
Preparation of pykintone usage environment
--Docker python pull --Installing pykintone
Docker pull python Get the latest Docker python. It's easy because you just pull it.
> docker pull python
Using default tag: latest
latest: Pulling from library/python
5040bd298390: Pull complete
fce5728aad85: Pull complete
76610ec20bf5: Pull complete
52f3db4b5710: Pull complete
45b2a7e03e44: Pull complete
75ef15b2048b: Pull complete
e41da2f0bac3: Pull complete
Digest: sha256:cba517218b4342514e000557e6e9100018f980cda866420ff61bfa9628ced1dc
Status: Downloaded newer image for python:latest
The following is installed by default. python3 is the default and pip is also available.
python : python3.6 python3 : python3.6
pip : pip pip3 : pip3 pip3.6 : pip3.6
:/# python -V
Python 3.6.0
:/# which python
/usr/local/bin/python
:/# ls -la /usr/local/bin/python*
lrwxrwxrwx 1 root staff 7 Jan 18 02:52 /usr/local/bin/python -> python3
lrwxrwxrwx 1 root staff 14 Jan 18 02:52 /usr/local/bin/python-config -> python3-config
lrwxrwxrwx 1 root staff 9 Jan 18 02:52 /usr/local/bin/python3 -> python3.6
lrwxrwxrwx 1 root staff 16 Jan 18 02:52 /usr/local/bin/python3-config -> python3.6-config
-rwxr-xr-x 2 root staff 14312 Jan 18 02:52 /usr/local/bin/python3.6
lrwxrwxrwx 1 root staff 17 Jan 18 02:52 /usr/local/bin/python3.6-config -> python3.6m-config
-rwxr-xr-x 2 root staff 14312 Jan 18 02:52 /usr/local/bin/python3.6m
-rwxr-xr-x 1 root staff 3089 Jan 18 02:52 /usr/local/bin/python3.6m-config
root@b648d7a985a6:/# ls -la /usr/local/bin/pip*
-rwxr-xr-x 1 root staff 214 Jan 18 02:52 /usr/local/bin/pip
-rwxr-xr-x 1 root staff 214 Jan 18 02:52 /usr/local/bin/pip3
-rwxr-xr-x 1 root staff 214 Jan 18 02:52 /usr/local/bin/pip3.6
:/# which pip
/usr/local/bin/pip
:/var/work# ls -la /usr/local/bin/pip*
-rwxr-xr-x 1 root staff 214 Jan 18 02:52 /usr/local/bin/pip
-rwxr-xr-x 1 root staff 214 Jan 18 02:52 /usr/local/bin/pip3
-rwxr-xr-x 1 root staff 214 Jan 18 02:52 /usr/local/bin/pip3.6
Just install it with pip.
# pip install pykintone
Collecting pykintone
Downloading pykintone-0.3.9.zip
Collecting PyYAML (from pykintone)
Downloading PyYAML-3.12.tar.gz (253kB)
100% |████████████████████████████████| 256kB 1.6MB/s
Collecting requests (from pykintone)
Downloading requests-2.13.0-py2.py3-none-any.whl (584kB)
100% |████████████████████████████████| 593kB 1.6MB/s
Collecting pytz (from pykintone)
Downloading pytz-2016.10-py2.py3-none-any.whl (483kB)
100% |████████████████████████████████| 491kB 1.9MB/s
Collecting tzlocal (from pykintone)
Downloading tzlocal-1.3.tar.gz
Installing collected packages: PyYAML, requests, pytz, tzlocal, pykintone
Running setup.py install for PyYAML ... done
Running setup.py install for tzlocal ... done
Running setup.py install for pykintone ... done
Successfully installed PyYAML-3.12 pykintone-0.3.9 pytz-2016.10 requests-2.13.0 tzlocal-1.3
Create a record acquisition script according to the sample. Same as the one created by pykintone on Windows Subsystem for Linux.
getRec1.py
import pykintone
r = pykintone.app("kintone domain", "APPID", "API token").select("")
if r.ok:
records = r.records
print(records)
else:
print(r.error)
The record was retrieved and displayed on standard output.
python getRec1.py
[{'Author': {'value': {'name': 'Alex2013', 'code': 'Alex2013'}, 'type': 'CREATOR'}, 'String A': {'value': 'B02A', 'type': 'SINGLE_LINE_TEXT'}, 'Creation date and time': {'value': '2017-01-26T15:47:00Z', 'type': 'CREATED_TIME'}, 'String B': {'value': 'B02B', 'type': 'SINGLE_LINE_TEXT'}, 'String 2_3': {'value': 'B02C', 'type': 'SINGLE_LINE_TEXT'}, 'changer': {'value': {'name': 'Alex2013', 'code': 'Alex2013'}, 'type': 'MODIFIER'}, 'String 2_2': {'value': 'B02B', 'type': 'SINGLE_LINE_TEXT'}, 'Record number': {'value': '2', 'type': 'RECORD_NUMBER'}, 'String 1_1': {'value': 'A02A', 'type': 'SINGLE_LINE_TEXT'}, 'Update date and time': {'value': '2017-01-26T23:49:00Z', 'type': 'UPDATED_TIME'}, 'Lookup A': {'value': 'A02', 'type': 'SINGLE_LINE_TEXT'}, 'String 1_3': {'value': 'A02C', 'type': 'SINGLE_LINE_TEXT'}, 'ID': {'value': 'jj', 'type': 'SINGLE_LINE_TEXT'}, 'String 1_4': {'value': 'A02D', 'type': 'SINGLE_LINE_TEXT'}, 'String 1_2': {'value': 'A02B', 'type': 'SINGLE_LINE_TEXT'}, '$revision': {'value': '4', 'type': '__REVISION__'}, 'String 2_4': {'value': 'B02', 'type': 'SINGLE_LINE_TEXT'}, '$id': {'value': '2', 'type': '__ID__'}, 'String C': {'value': 'B02C', 'type': 'SINGLE_LINE_TEXT'}, 'String 2_1': {'value': 'B02A', 'type': 'SINGLE_LINE_TEXT'}, 'Lookup B': {'value': 'B02', 'type': 'SINGLE_LINE_TEXT'}, 'String D': {'value': 'B02', 'type': 'SINGLE_LINE_TEXT'}}, {'Author': {'value': {'name': 'Alex2013', 'code': 'Alex2013'}, 'type': 'CREATOR'}, 'String A': {'value': 'B01A', 'type': 'SINGLE_LINE_TEXT'}, 'Creation date and time': {'value': '2017-01-26T12:06:00Z', 'type': 'CREATED_TIME'}, 'String B': {'value': 'B01B', 'type': 'SINGLE_LINE_TEXT'}, 'String 2_3': {'value': 'B01C', 'type': 'SINGLE_LINE_TEXT'}, 'changer': {'value': {'name': 'Alex2013', 'code': 'Alex2013'}, 'type': 'MODIFIER'}, 'String 2_2': {'value': 'B01B', 'type': 'SINGLE_LINE_TEXT'}, 'Record number': {'value': '1', 'type': 'RECORD_NUMBER'}, 'String 1_1': {'value': 'A01A', 'type': 'SINGLE_LINE_TEXT'}, 'Update date and time': {'value': '2017-01-26T12:06:00Z', 'type': 'UPDATED_TIME'}, 'Lookup A': {'value': 'A01', 'type': 'SINGLE_LINE_TEXT'}, 'String 1_3': {'value': 'A01C', 'type': 'SINGLE_LINE_TEXT'}, 'ID': {'value': 'C01', 'type': 'SINGLE_LINE_TEXT'}, 'String 1_4': {'value': 'A01D', 'type': 'SINGLE_LINE_TEXT'}, 'String 1_2': {'value': 'A01B', 'type': 'SINGLE_LINE_TEXT'}, '$revision': {'value': '1', 'type': '__REVISION__'}, 'String 2_4': {'value': 'B01D', 'type': 'SINGLE_LINE_TEXT'}, '$id': {'value': '1', 'type': '__ID__'}, 'String C': {'value': 'B01C', 'type': 'SINGLE_LINE_TEXT'}, 'String 2_1': {'value': 'B01A', 'type': 'SINGLE_LINE_TEXT'}, 'Lookup B': {'value': 'B01', 'type': 'SINGLE_LINE_TEXT'}, 'String D': {'value': 'B01D', 'type': 'SINGLE_LINE_TEXT'}}]
Recommended Posts