Skip to content

I try use the sdk-python cdn, but I try failed #8

Description

@Andy-tanbin

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions