網宿cdn api 刷新緩存函數

import hashlib,requestsapp

def wangsu_cdn_flush(user,password,purge):
    Headers = {"Content-Type": "application/x-www-form-urlencoded",
                   "Connection": "Keep-Alive"}
    sign = hashlib.md5(user+password+purge).hexdigest()
    Data = "username=%s&passwd=%s&url=%s" %(user,sign,purge)
    response = requests.post('http://wscp.lxdns.com:8080/wsCP/servlet/contReceiver?',data=Data,headers=Headers)
    return response.textpost

if __name__ == "__main__":url

    PURGE = 'http://xxx/static/images/Vnew/i4.jpg; http://xxx/static/images/Vnew/gsl_001.png;'code

    user='xxxx'
    password='xxx'
    wangsu_flush(user,password,PURGE)orm

執行返回:cdn

success append purge tasks... 刷新成功dns

相關文章
相關標籤/搜索