Skip to content

Commit

Permalink
adjust format
Browse files Browse the repository at this point in the history
  • Loading branch information
bernieyangmh committed Feb 25, 2019
1 parent 0be91dd commit 199a87f
Show file tree
Hide file tree
Showing 21 changed files with 54 additions and 22 deletions.
3 changes: 3 additions & 0 deletions examples/batch_copy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
# flake8: noqa


"""
批量拷贝文件
Expand Down
2 changes: 2 additions & 0 deletions examples/batch_delete.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# flake8: noqa

"""
批量删除文件
Expand Down
2 changes: 2 additions & 0 deletions examples/batch_move.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# flake8: noqa

"""
批量移动文件
Expand Down
2 changes: 2 additions & 0 deletions examples/batch_rename.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# flake8: noqa

"""
批量重命名文件
Expand Down
2 changes: 2 additions & 0 deletions examples/batch_stat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# flake8: noqa

"""
批量查询文件信息
Expand Down
2 changes: 2 additions & 0 deletions examples/cdn_bandwidth.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# flake8: noqa

"""
查询指定域名指定时间段内的带宽
"""
Expand Down
2 changes: 2 additions & 0 deletions examples/cdn_flux.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# flake8: noqa

"""
查询指定域名指定时间段内的流量
"""
Expand Down
2 changes: 2 additions & 0 deletions examples/cdn_log.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# flake8: noqa

"""
获取指定域名指定时间内的日志链接
"""
Expand Down
2 changes: 2 additions & 0 deletions examples/change_mime.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# flake8: noqa

"""
改变文件的mimeType
"""
Expand Down
2 changes: 2 additions & 0 deletions examples/change_status.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# flake8: noqa

"""
改变文件状态,可用或不可用
"""
Expand Down
2 changes: 2 additions & 0 deletions examples/create_bucket.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# flake8: noqa

"""
创建存储空间
"""
Expand Down
2 changes: 2 additions & 0 deletions examples/list_buckets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# flake8: noqa

"""
列举账号下的空间
"""
Expand Down
1 change: 1 addition & 0 deletions examples/prefetch_to_cdn.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
# flake8: noqa

"""
预取资源到cdn节点
Expand Down
2 changes: 2 additions & 0 deletions examples/refresh_dirs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# flake8: noqa

import qiniu
from qiniu import CdnManager

Expand Down
2 changes: 2 additions & 0 deletions examples/refresh_urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# flake8: noqa

import qiniu
from qiniu import CdnManager

Expand Down
1 change: 1 addition & 0 deletions examples/rtc_server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
# flake8: noqa

from qiniu import QiniuMacAuth
from qiniu import RtcServer, get_room_token
Expand Down
1 change: 1 addition & 0 deletions examples/timestamp_url.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
# flake8: noqa

"""
获取一个配置时间戳防盗链的url
Expand Down
2 changes: 2 additions & 0 deletions examples/update_cdn_sslcert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# flake8: noqa

"""
更新cdn证书(可配合let's encrypt 等完成自动证书更新)
"""
Expand Down
35 changes: 17 additions & 18 deletions qiniu/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,33 @@
from .compat import urlparse, json, b
from .utils import urlsafe_base64_encode


# 上传策略,参数规格详见
# https://developer.qiniu.com/kodo/manual/1206/put-policy
_policy_fields = set([
'callbackUrl', # 回调URL
'callbackBody', # 回调Body
'callbackHost', # 回调URL指定的Host
'callbackUrl', # 回调URL
'callbackBody', # 回调Body
'callbackHost', # 回调URL指定的Host
'callbackBodyType', # 回调Body的Content-Type
'callbackFetchKey', # 回调FetchKey模式开关

'returnUrl', # 上传端的303跳转URL
'returnBody', # 上传端简单反馈获取的Body
'returnUrl', # 上传端的303跳转URL
'returnBody', # 上传端简单反馈获取的Body

'endUser', # 回调时上传端标识
'saveKey', # 自定义资源名
'insertOnly', # 插入模式开关
'endUser', # 回调时上传端标识
'saveKey', # 自定义资源名
'insertOnly', # 插入模式开关

'detectMime', # MimeType侦测开关
'mimeLimit', # MimeType限制
'fsizeLimit', # 上传文件大小限制
'fsizeMin', # 上传文件最少字节数
'detectMime', # MimeType侦测开关
'mimeLimit', # MimeType限制
'fsizeLimit', # 上传文件大小限制
'fsizeMin', # 上传文件最少字节数

'persistentOps', # 持久化处理操作
'persistentOps', # 持久化处理操作
'persistentNotifyUrl', # 持久化处理结果通知URL
'persistentPipeline', # 持久化处理独享队列
'deleteAfterDays', # 文件多少天后自动删除
'fileType', # 文件的存储类型,0为普通存储,1为低频存储
'isPrefixalScope' # 指定上传文件必须使用的前缀
'persistentPipeline', # 持久化处理独享队列
'deleteAfterDays', # 文件多少天后自动删除
'fileType', # 文件的存储类型,0为普通存储,1为低频存储
'isPrefixalScope' # 指定上传文件必须使用的前缀
])


Expand Down
5 changes: 2 additions & 3 deletions qiniu/services/storage/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from qiniu import config
from qiniu import http
from qiniu.utils import urlsafe_base64_encode, entry
import json


class BucketManager(object):
Expand Down Expand Up @@ -239,8 +238,8 @@ def change_status(self, bucket, key, status, cond):
resource = entry(bucket, key)
if cond and isinstance(cond, dict):
condstr = ""
for k,v in cond.items():
condstr+="{0}={1}&".format(k, v)
for k, v in cond.items():
condstr += "{0}={1}&".format(k, v)
condstr = urlsafe_base64_encode(condstr[:-1])
return self.__rs_do('chstatus', resource, 'status/{0}'.format(status), 'cond', condstr)
return self.__rs_do('chstatus', resource, 'status/{0}'.format(status))
Expand Down
2 changes: 1 addition & 1 deletion qiniu/services/storage/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def upload(self):
if config.get_default('default_zone').up_host_backup:
host = config.get_default('default_zone').up_host_backup
else:
host = config.get_default('default_zone').get_up_host_backup_by_token(up_token)
host = config.get_default('default_zone').get_up_host_backup_by_token(self.up_token)
if info.need_retry() or crc != ret['crc32']:
ret, info = self.make_block(block, length, host)
if ret is None or crc != ret['crc32']:
Expand Down

0 comments on commit 199a87f

Please sign in to comment.