File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -151,4 +151,7 @@ def entry(bucket, key):
151
151
Returns:
152
152
符合七牛API规格的数据格式
153
153
"""
154
- return urlsafe_base64_encode ('{0}:{1}' .format (bucket , key ))
154
+ if key is None :
155
+ return urlsafe_base64_encode ('{0}' .format (bucket ))
156
+ else :
157
+ return urlsafe_base64_encode ('{0}:{1}' .format (bucket , key ))
Original file line number Diff line number Diff line change @@ -125,6 +125,12 @@ def test_fetch(self):
125
125
assert ret ['key' ] == 'fetch.html'
126
126
assert ret ['hash' ] == 'FhwVT7vs6xqs1nu_vEdo_4x4qBMB'
127
127
128
+ def test_fetch_without_key (self ):
129
+ ret , info = self .bucket .fetch ('http://developer.qiniu.com/docs/v6/sdk/python-sdk.html' , bucket_name )
130
+ print (info )
131
+ assert ret ['key' ] == 'FhwVT7vs6xqs1nu_vEdo_4x4qBMB'
132
+ assert ret ['hash' ] == 'FhwVT7vs6xqs1nu_vEdo_4x4qBMB'
133
+
128
134
def test_stat (self ):
129
135
ret , info = self .bucket .stat (bucket_name , 'python-sdk.html' )
130
136
print (info )
You can’t perform that action at this time.
0 commit comments