所有文档

          内容分发网络 CDN

          缓存管理

          刷新缓存

          def test_purge(self):
              """
              test_purge
              """
              error = None
              try:
                  tasks = []
                  tasks.append({'url': 'http://opencdn3.sys-qa.com/1.jpg'})
                  tasks.append({'url': 'http://opencdn3.sys-qa.com/', "type":"directory"})
                  response = self.cdn_client.purge(tasks)
                  print response
              except BceServerError as e:
                  error = e
              finally:
                  self.assertIsNone(error)

          查询刷新结果

          def test_list_purge_tasks(self):
              """
              test_list_purge_tasks
              """
              error = None
              try:
                  response = self.cdn_client.list_purge_tasks(
                                      id = 'eJwztjA3swQAAy4BEg==',
                                      url = 'http://opencdn3.sys-qa.com/1.jpg',
                                      startTime = '2017-01-18T10:00:00Z',
                                      endTime = '2017-01-18T12:50:00Z')
                  print response
              except BceServerError as e:
                  error = e
              finally:
                  self.assertIsNone(error)

          预热缓存

          def test_prefetch(self):
              """
              test_prefetch
              """
              error = None
              try:
                  tasks = []
                  tasks.append({'url': 'http://opencdn3.sys-qa.com/1.jpg'})
                  tasks.append({'url': 'http://opencdn3.sys-qa.com/2.jpg'})
                  response = self.cdn_client.prefetch(tasks)
                  print response
              except BceServerError as e:
                  error = e
              finally:
                  self.assertIsNone(error)

          查询预热结果

          def test_list_prefetch_tasks(self):
              """
              test_list_prefetch_tasks
              """
              error = None
              try:
                  response = self.cdn_client.list_prefetch_tasks(
                                      id = 'c942f806-1246-5870-e724-1d579b56d438',
                                      startTime = '2017-01-18T10:00:00Z',
                                      endTime = '2017-01-18T12:50:00Z')
                  print response
              except BceServerError as e:
                  error = e
              finally:
                  self.assertIsNone(error)

          操作记录

          def test_get_domain_records(c):
              """
              Query refresh and preload records
              """
          
              Type = "purge"
              start_time = '2019-05-26T00:00:00Z'
              end_time = '2019-05-26T01:00:00Z'
              url = 'http://test-sdk.sys-qa.com/path/to/directory/'
              marker = None
          
              response = c.get_domain_records(Type, start_time, end_time, url, marker)
              print(response)
          上一篇
          加速域名配置
          下一篇
          动态加速接口