LoginSignup
0
2

More than 5 years have passed since last update.

Python で Domo のデータセットの一覧を取得する

Last updated at Posted at 2017-09-22

access_token の取得は
Python で Domo の アクセストークンを取得する

#! /usr/bin/python
# -*- coding: utf-8 -*-
#
#   main_list_dataset.py
#
#                   Sep/22/2017
#
# ------------------------------------------------------------------
import  sys
import  requests
#
from domo_config import domo_config_proc
from get_access_token import get_access_token_proc
from list_dataset import list_dataset_proc
# ------------------------------------------------------------------
sys.stderr.write("*** 開始 ***\n")
#
config = domo_config_proc()
#
access_token = get_access_token_proc(config)
#
json_str = list_dataset_proc(access_token)
#
print(json_str)
#
sys.stderr.write("*** 終了 ***\n")
#
# ------------------------------------------------------------------
list_dataset.py
# -*- coding: utf-8 -*-
#
#   list_dataset.py
#
#                   Sep/22/2017
#
# ------------------------------------------------------------------
import  sys
import  requests
#
# ------------------------------------------------------------------
def list_dataset_proc(access_token):
    sys.stderr.write("*** list_dataset_proc *** start ***\n")
    headers = {"Authorization": "Bearer " + access_token
        }
    params = {
        "includeHeader": "true",
        "sort": "name",
        "offset": 0,
        "limit": 50
        }
#
    url_datasets="https://api.domo.com/v1/datasets"
#
    try:
        rr=requests.get(url_datasets,params=params,headers=headers)
        print(rr.status_code)
    except Exception as ee:
        sys.stderr.write(str(ee) + "\n")
#
    sys.stderr.write("*** list_dataset_proc *** end ***\n")
#
    return rr.text
# ------------------------------------------------------------------

API の仕様はこちら
List DataSets

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2