#!/usr/bin/env python # encoding: utf-8 """ > FileName: get_cmdbuild_os.py > Author: FZH > Mail: [email protected] > CreatedTime: 18/12/14 下午2:56 """ import requests from cmdbuild.config import * from .get_cmdbuild_token import cmdbuild_token from cmdbuild.CmdbClassAPI import cmdb_class_api CLASS = cmdb_class_api('CLASS')['cls'] def cmdbuild_class(): token = cmdbuild_token() if token: url = URI_CLASS headers = { 'Content-Type': "application/json", 'CMDBuild-Authorization': token } response = requests.request("GET", url, headers=headers) print(response.text) return response.text else:
#!/usr/bin/env python # encoding: utf-8 """ > FileName: get_cdmbuild_token > Author: FZH > Mail: [email protected] > CreatedTime: 18/12/13 下午8:01 """ import json import requests from cmdbuild.config import * from cmdbuild.CmdbClassAPI import cmdb_class_api SESSIONS = cmdb_class_api('SESSIONS')['cls'] def cmdbuild_token(): url = URI_TOKEN + SESSIONS payload = { "username": USER_NAME, "password": PASSWORD } headers = { 'Content-Type': "application/json" } try: response = requests.request("POST",
#!/usr/bin/env python # encoding: utf-8 """ > FileName: get_cmdbuild_business.py > Author: FZH > Mail: [email protected] > CreatedTime: 18/12/14 下午5:57 """ import requests from .get_cmdbuild_token import cmdbuild_token from cmdbuild.config import * from cmdbuild.CmdbClassAPI import cmdb_class_api BUSINESS = cmdb_class_api('BUSINESS')['cls'] def cmdbuild_business(): token = cmdbuild_token() if token: url = URI_CLASS + BUSINESS + "/cards" headers = { 'Content-Type': "application/json", 'CMDBuild-Authorization': token } response = requests.request("GET", url, headers=headers) print(response.text) return response.text else:
#!/usr/bin/env python # encoding: utf-8 """ > FileName: get_cmdbuild_server.py > Author: FZH > Mail: [email protected] > CreatedTime: 18/12/14 下午6:01 """ import requests from cmdbuild.config import * from .get_cmdbuild_token import cmdbuild_token from cmdbuild.CmdbClassAPI import cmdb_class_api SERVER = cmdb_class_api('SERVER')['cls'] def cmdbuild_server(): token = cmdbuild_token() if token: url = URI_CLASS + SERVER + "/cards" headers = { 'Content-Type': "application/json", 'CMDBuild-Authorization': token } response = requests.request("GET", url, headers=headers) print(response.text) return response.text else: return
#!/usr/bin/env python # encoding: utf-8 """ > FileName: get_cmdbuild_os.py > Author: FZH > Mail: [email protected] > CreatedTime: 18/12/14 下午5:42 """ from cmdbuild.config import * from .get_cmdbuild_token import cmdbuild_token from cmdbuild.CmdbClassAPI import cmdb_class_api import requests ENV = cmdb_class_api('ENV')['cls'] def cmdbuild_env(): token = cmdbuild_token() if token: url = URI_CLASS + ENV + "/cards" headers = { 'Content-Type': "application/json", 'CMDBuild-Authorization': token } response = requests.request("GET", url, headers=headers) print(response.text) return response.text else: