-
Notifications
You must be signed in to change notification settings - Fork 17
Description
refresh files or dirs:
Traceback (most recent call last):
File "huawei_cdn.py", line 41, in
refreshTask(refreshFileTask)
File "huawei_cdn.py", line 27, in refreshTask
refreshtask = conn.cdn.create_refresh_task(**refreshTask)
File "/root/flush_cdn/huaweicloud-sdk-python/openstack/cdn/v1/_proxy.py", line 663, in create_refresh_task
return self._create(_task.RefreshTask, **attrs)
File "/root/flush_cdn/huaweicloud-sdk-python/openstack/proxy2.py", line 218, in _create
return res.create(self._session, prepend_key=prepend_key)
File "/root/flush_cdn/huaweicloud-sdk-python/openstack/cdn/v1/task.py", line 163, in create
json=request.body, headers=request.headers, params={"enterprise_project_id": 'ALL'})
File "/root/env/lib/python2.7/site-packages/keystoneauth1/session.py", line 848, in post
return self.request(url, 'POST', **kwargs)
File "/root/flush_cdn/huaweicloud-sdk-python/openstack/session.py", line 70, in map_exceptions_wrapper
raise exceptions.SDKException(message=e.message, cause=e)
openstack.exceptions.SDKException: Could not find requested endpoint in Service Catalog.
this is my code:
projectId = "1xxxxxxxxxxx"
cloud = "myhwclouds.com" # cdn use: cloud = "myhwclouds.com"
region= "cn-east-2" # example: region = "cn-north-1"
AK = "xxxxx"
SK = "xxxxxx"
conn = connection.Connection(
project_id=projectId,
cloud=cloud,
region=region,
ak=AK,
sk=SK)
def refreshTask(refreshTask):
print("refresh files or dirs:")
refreshtask = conn.cdn.create_refresh_task(**refreshTask)
print(refreshtask)
if name == "main":
refreshFileTask={
"type": "file",
"urls": ["http://xxxxx/index.html",]
}
refreshDirTask={
"type": "directory",
"urls": ["xxxxxxxxxxx",
"xxxxxxxxxxx"]
}
refreshTask(refreshFileTask)