Skip to content

update putpolicy #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions qiniu/rs/rs_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ class PutPolicy(object):
endUser = None
asyncOps = None

saveKey = None
insertOnly = None
detectMime = None
fsizeLimit = None
persistentNotifyUrl = None
persistentOps = None

def __init__(self, scope):
self.scope = scope
# @endgist
Expand Down Expand Up @@ -46,15 +53,33 @@ def token(self, mac=None):

if self.asyncOps is not None:
token["asyncOps"] = self.asyncOps


if self.saveKey is not None:
token["saveKey"] = self.saveKey

if self.insertOnly is not None:
token["exclusive"] = self.insertOnly

if self.detectMime is not None:
token["detectMime"] = self.detectMime

if self.fsizeLimit is not None:
token["fsizeLimit"] = self.fsizeLimit

if self.persistentOps is not None:
token["persistentOps"] = self.persistentOps

if self.persistentNotifyUrl is not None:
token["persistentNotifyUrl"] = self.persistentNotifyUrl

b = json.dumps(token, separators=(',',':'))
return mac.sign_with_data(b)

class GetPolicy(object):
expires = 3600
def __init__(self):
pass

def make_request(self, base_url, mac=None):
'''
* return private_url
Expand Down