Authored by root

Remove qiniu scripts

{"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 newline at end of file
No preview for this file type
# -*- coding: utf-8 -*-
# flake8: noqa
from qiniu import Auth
from qiniu import BucketManager
def do_delete(access_key,secret_key,bucket_name,dst_file):
#初始化Auth状态
q = Auth(access_key, secret_key)
#初始化BucketManager
bucket = BucketManager(q)
#你要测试的空间, 并且这个key在你空间中存在
#删除bucket_name 中的文件 key
try:
ret, info = bucket.delete(bucket_name, dst_file)
assert ret == {}
print 'info:',info.text_body
except Exception as e:
print e.message
if 'no such key' in info.text_body:
return True
else:
return False
return True
No preview for this file type
# -*- coding: utf-8 -*-
import qiniu
from qiniu import CdnManager
def do_refresh(access_key,secret_key,url):
auth = qiniu.Auth(access_key, secret_key)
cdn_manager = CdnManager(auth)
# 需要刷新的文件链接
urls = [
url
]
# 刷新链接
refresh_url_result = cdn_manager.refresh_urls(urls)
print refresh_url_result
return True
# -*- coding: utf-8 -*-
# flake8: noqa
from qiniu import Auth, put_file, etag
import qiniu.config
def do_upload(access_key,secret_key,bucket_name,src_file,dst_file):
#需要填写你的 Access Key 和 Secret Key
access_key = 'BwWhoJN536BnV3CzlE20AjNKC9O2bP0l5tFpKsDU'
secret_key = '_x2VtO7fEmylgjojmLi7qwTBtRm30S8BrO0FxOPK'
#构建鉴权对象
q = Auth(access_key, secret_key)
#要上传的空间
#上传到七牛后保存的文件名
#生成上传 Token,可以指定过期时间等
token = q.upload_token(bucket_name, dst_file, 3600)
#要上传文件的本地路径
ret, info = put_file(token, dst_file, src_file)
try:
assert ret['key'] == dst_file
assert ret['hash'] == etag(src_file)
except Exception as e:
print e.message
return False
return True
No preview for this file type
import sys
from lib import delete,upload
def start(access_key,secret_key,bucket_name,src_file,dst_file):
#delete.do_delete(access_key,secret_key,bucket_name,dst_file)
upload.do_upload(access_key,secret_key,bucket_name,src_file,dst_file)
return True