Authored by root

Remove qiniu scripts

1 -{"http:BwWhoJN536BnV3CzlE20AjNKC9O2bP0l5tFpKsDU:ad-yoho-cn": {"ioHosts": ["http://iovip.qbox.me"], "upHosts": ["http://up.qiniu.com", "http://upload.qiniu.com", "-H up.qiniu.com http://183.131.7.18"], "deadline": 1536127512}}  
No preview for this file type
1 -# -*- coding: utf-8 -*-  
2 -# flake8: noqa  
3 -from qiniu import Auth  
4 -from qiniu import BucketManager  
5 -  
6 -  
7 -def do_delete(access_key,secret_key,bucket_name,dst_file):  
8 - #初始化Auth状态  
9 - q = Auth(access_key, secret_key)  
10 - #初始化BucketManager  
11 - bucket = BucketManager(q)  
12 - #你要测试的空间, 并且这个key在你空间中存在  
13 - #删除bucket_name 中的文件 key  
14 - try:  
15 - ret, info = bucket.delete(bucket_name, dst_file)  
16 - assert ret == {}  
17 - print 'info:',info.text_body  
18 - except Exception as e:  
19 - print e.message  
20 - if 'no such key' in info.text_body:  
21 - return True  
22 - else:  
23 - return False  
24 - return True  
No preview for this file type
1 -# -*- coding: utf-8 -*-  
2 -import qiniu  
3 -from qiniu import CdnManager  
4 -  
5 -def do_refresh(access_key,secret_key,url):  
6 - auth = qiniu.Auth(access_key, secret_key)  
7 - cdn_manager = CdnManager(auth)  
8 - # 需要刷新的文件链接  
9 - urls = [  
10 - url  
11 - ]  
12 - # 刷新链接  
13 - refresh_url_result = cdn_manager.refresh_urls(urls)  
14 - print refresh_url_result  
15 - return True  
1 -# -*- coding: utf-8 -*-  
2 -# flake8: noqa  
3 -from qiniu import Auth, put_file, etag  
4 -import qiniu.config  
5 -  
6 -def do_upload(access_key,secret_key,bucket_name,src_file,dst_file):  
7 - #需要填写你的 Access Key 和 Secret Key  
8 - access_key = 'BwWhoJN536BnV3CzlE20AjNKC9O2bP0l5tFpKsDU'  
9 - secret_key = '_x2VtO7fEmylgjojmLi7qwTBtRm30S8BrO0FxOPK'  
10 - #构建鉴权对象  
11 - q = Auth(access_key, secret_key)  
12 - #要上传的空间  
13 - #上传到七牛后保存的文件名  
14 - #生成上传 Token,可以指定过期时间等  
15 - token = q.upload_token(bucket_name, dst_file, 3600)  
16 - #要上传文件的本地路径  
17 - ret, info = put_file(token, dst_file, src_file)  
18 - try:  
19 - assert ret['key'] == dst_file  
20 - assert ret['hash'] == etag(src_file)  
21 - except Exception as e:  
22 - print e.message  
23 - return False  
24 - return True  
No preview for this file type
1 -import sys  
2 -from lib import delete,upload  
3 -  
4 -def start(access_key,secret_key,bucket_name,src_file,dst_file):  
5 - #delete.do_delete(access_key,secret_key,bucket_name,dst_file)  
6 - upload.do_upload(access_key,secret_key,bucket_name,src_file,dst_file)  
7 - return True