import hashlib,requests
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.text
if __name__ == "__main__":
PURGE = 'http://xxx/static/images/Vnew/i4.jpg; http://xxx/static/images/Vnew/gsl_001.png;'
user='xxxx'
password='xxx'
wangsu_flush(user,password,PURGE)
执行返回:
success append purge tasks... 刷新成功