0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Python で Domo のデータセットを削除する

Last updated at Posted at 2017-09-21

データセットの作成方法は、こちら
Python で Domo のデータセットを作成する

ここで、表示された dataset_id を使えば、作成されたデータセットを削除できます。

# ! /usr/bin/python
# -*- coding: utf-8 -*-
#
#	main_delete_dataset.py
#
#					Sep/21/2017
#
# ------------------------------------------------------------------
import	sys
import	requests
#
from get_access_token import get_access_token_proc
from delete_dataset import delete_dataset_proc
from domo_config import domo_config_proc
# ------------------------------------------------------------------
sys.stderr.write("*** 開始 ***\n")
#
config = domo_config_proc()
access_token = get_access_token_proc(config)
#
dataset_id="4e7a793f-21d1-4afb-8d87-915267f7cf8g"
#
json_str = delete_dataset_proc(access_token,dataset_id)
#
print(json_str)
#
sys.stderr.write("*** 終了 ***\n")
#
# ------------------------------------------------------------------
delete_dataset.py
# -*- coding: utf-8 -*-
#
#	delete_dataset.py
#
#					Sep/21/2017
#
# ------------------------------------------------------------------
import	sys
import	requests
#
# ------------------------------------------------------------------
def delete_dataset_proc(access_token,dataset_id):
	sys.stderr.write("*** delete_dataset_proc *** start ***\n")
	headers = {"Authorization": "Bearer " + access_token
		}
	params = {
		"includeHeader": "true",
		}
#
	url_datasets="https://api.domo.com/v1/datasets/" + dataset_id
#
	try:
		rr=requests.delete(url_datasets,params=params,headers=headers)
		print(rr.status_code)
	except Exception as ee:
		sys.stderr.write(str(ee) + "\n")
#
	sys.stderr.write("*** delete_dataset_proc *** end ***\n")
#
	return rr.text
# ------------------------------------------------------------------

API の仕様はこちら
Delete a DataSet

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?