如何使用 cf-python-client 模块查询 GET /v2/organizations/:guid/managers
how to query for GET /v2/organizations/:guid/managers using cf-python-client module
我正在使用从这个 link 下载的 cf-python-client
模块,我正在尝试获取组织的经理
我可以通过这个获取组织信息
client.v2.organizations.get(org_guid)
但现在我想获得与该组织关联的经理,所需的 API 是 GET /v2/organizations/:guid/managers
但我不知道如何通过 cf-python-client
模块使用它。
这就是我连接到 Cloudfoundry 的方式
from cloudfoundry_client.client import CloudFoundryClient
client = CloudFoundryClient(target_endpoint, proxy=proxy, verify=False)
client.init_with_user_credentials( 'admin', 'password' )
我尝试了这个 client.v2.organizations._get("/"+ORG_GUID+"/managers")
并得到了这个
错误:
Traceback (most recent call last):
File "orgs.py", line 31, in <module>
print client.v2.organizations._get("/"+ORG_GUID+"/managers")
File "/usr/local/lib/python2.7/dist-
packages/cloudfoundry_client/v2/entities.py", line 54, in _get
response = self.client.get(url)
File "/usr/local/lib/python2.7/dist-
packages/cloudfoundry_client/client.py", line 167, in get
return CloudFoundryClient._check_response(response)
File "/usr/local/lib/python2.7/dist-
packages/cloudfoundry_client/client.py", line 194, in _check_response
raise InvalidStatusCode(response.status_code, body)
cloudfoundry_client.errors.InvalidStatusCode: 404 : {"code": 10000,
"error_code": "CF-NotFound", "description": "Unknown request"}
试试这个 :)
from cloudfoundry_client.client import CloudFoundryClient
import os
target_endpoint = '<API_URL>'
proxy = dict(http=os.environ.get('HTTP_PROXY', ''), https=os.environ.get('HTTPS_PROXY', ''))
client = CloudFoundryClient(target_endpoint, proxy=proxy, verify=False)
client.init_with_user_credentials('<EMAIL>', '<PASSWORD>')
org_get = client.v2.organizations.get('<GUID>')
print(org_get)
for m in org_get.managers():
print(m)
我正在使用从这个 link 下载的 cf-python-client
模块,我正在尝试获取组织的经理
我可以通过这个获取组织信息
client.v2.organizations.get(org_guid)
但现在我想获得与该组织关联的经理,所需的 API 是 GET /v2/organizations/:guid/managers
但我不知道如何通过 cf-python-client
模块使用它。
这就是我连接到 Cloudfoundry 的方式
from cloudfoundry_client.client import CloudFoundryClient
client = CloudFoundryClient(target_endpoint, proxy=proxy, verify=False)
client.init_with_user_credentials( 'admin', 'password' )
我尝试了这个 client.v2.organizations._get("/"+ORG_GUID+"/managers")
并得到了这个
错误:
Traceback (most recent call last):
File "orgs.py", line 31, in <module>
print client.v2.organizations._get("/"+ORG_GUID+"/managers")
File "/usr/local/lib/python2.7/dist-
packages/cloudfoundry_client/v2/entities.py", line 54, in _get
response = self.client.get(url)
File "/usr/local/lib/python2.7/dist-
packages/cloudfoundry_client/client.py", line 167, in get
return CloudFoundryClient._check_response(response)
File "/usr/local/lib/python2.7/dist-
packages/cloudfoundry_client/client.py", line 194, in _check_response
raise InvalidStatusCode(response.status_code, body)
cloudfoundry_client.errors.InvalidStatusCode: 404 : {"code": 10000,
"error_code": "CF-NotFound", "description": "Unknown request"}
试试这个 :)
from cloudfoundry_client.client import CloudFoundryClient
import os
target_endpoint = '<API_URL>'
proxy = dict(http=os.environ.get('HTTP_PROXY', ''), https=os.environ.get('HTTPS_PROXY', ''))
client = CloudFoundryClient(target_endpoint, proxy=proxy, verify=False)
client.init_with_user_credentials('<EMAIL>', '<PASSWORD>')
org_get = client.v2.organizations.get('<GUID>')
print(org_get)
for m in org_get.managers():
print(m)