高级设置
更新时间:2023-05-16
下列代码中对函数入参c即是CdnClient对象,详情参见CdnClient
设置HttpHeader
def test_set_domain_http_header(c):
"""
test set domain http header
"""
http_header = [
{"type": "origin", "header": "x-auth-cn", "value":"xxxxxxxxx", "action": "add"},
{"type": "response", "header": "content-type", "value":"application/octet-stream", "action": "add"}
]
domain = 'test-sdk.sys-qa.com'
response = c.set_domain_http_header(domain, http_header);
print(response)
查询HttpHeader
def test_get_domain_http_header(c):
"""
test get domain http header
"""
response = c.get_domain_http_header('test-sdk.sys-qa.com')
print(response)
设置页面优化
def test_set_domain_file_trim(c):
"""
test set domain file trim
"""
file_trim = True
domain = 'test-sdk.sys-qa.com'
response = c.set_domain_file_trim(domain, file_trim);
print(response)
查询页面优化
def test_get_domain_file_trim(c):
"""
test get domain file trim
"""
response = c.get_domain_file_trim('test-sdk.sys-qa.com')
print(response)
设置视频拖拽
def test_set_domain_media_drag(c):
"""
test set domain media drag
"""
media_drag = {
"mp4":{
"fileSuffix":[
"mp4",
"m4a"
],
"startArgName":"startIndex",
"dragMode":"second"
},
"flv":{
"dragMode":"byteAV"
}
}
domain = 'test-sdk.sys-qa.com'
response = c.set_domain_media_drag(domain, media_drag);
print(response)
查询视频拖拽
def test_get_domain_media_drag(c):
"""
test get domain media drag
"""
response = c.get_domain_media_drag('test-sdk.sys-qa.com')
print(response)
设置页面压缩
def test_set_domain_compress(c):
"""
test set domain compress
"""
compress = {"allow": True, "type": "gzip"}
domain = 'test-sdk.sys-qa.com'
response = c.set_domain_compress(domain, compress);
print(response)
查询页面压缩
def test_get_domain_compress(c):
"""
test get domain compress
"""
response = c.get_domain_compress('test-sdk.sys-qa.com')
print(response)
设置ipv6调度
def test_set_ipv6_dispatch(c):
"""
test_set_ipv6_dispatch
"""
ipv6_dispatch = {"enable": False}
response = c.set_domain_ipv6_dispatch('example.test.com', ipv6_dispatch)
print(response)
查询ipv6调度配置
def test_get_ipv6_dispatch(c):
"""
test_get_ipv6_dispatch
"""
response = c.get_domain_ipv6_dispatch('example.test.com')
print(response)
设置quic
def test_set_quic(c):
"""
test_set_quic
"""
quic = False
response = c.set_domain_quic('example.test.com', quic)
print(response)
查询quic配置
def test_get_quic(c):
"""
test_get_quic
"""
response = c.get_domain_quic('example.test.com')
print(response)
设置离线模式
def test_set_offline_mode(c):
"""
test_set_offline_mode
"""
offline_mode = True
response = c.set_domain_offline_mode('example.test.com', offline_mode)
print(response)
查询离线模式配置
def test_get_offline_mode(c):
"""
test_get_offline_mode
"""
response = c.get_domain_offline_mode('example.test.com')
print(response)