Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
requestモジュールで実行
#!/usr/bin/python3
import requests
import json
# 自己証明書の警告を出力しないようにする
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
# URL/ユーザー情報
url = 'https://vROps IP or FQDN/suite-api/api/actiondefinitions'
user = 'admin'
passwd = 'change me'
# ヘッダーの設定
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
# Getリクエスト
r = requests.get(url,
auth=requests.auth.HTTPBasicAuth(
user,
passwd),
headers=headers,
verify=False)
# JSONをパース
j = json.loads(r.text)
# JSONを見やすいように整形
print(json.dumps(j, indent=2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.