File tree Expand file tree Collapse file tree 4 files changed +103
-0
lines changed Expand file tree Collapse file tree 4 files changed +103
-0
lines changed Original file line number Diff line number Diff line change 1
1
## CHANGE LOG
2
2
3
+ ### v6.1.5
4
+
5
+ 2014-04-08 issue [ #98 ] ( https://github.com/qiniu/python-sdk/pull/98 )
6
+
7
+ - [ #98 ] 增加fetch、prefetch、pfop三个接口的范例代码
8
+
3
9
### v6.1.4
4
10
5
11
2014-03-28 issue [ #95 ] ( https://github.com/qiniu/python-sdk/pull/95 )
Original file line number Diff line number Diff line change
1
+ #coding=utf-8
2
+ import sys
3
+ sys .path .insert (0 , "../../" )
4
+
5
+ from base64 import urlsafe_b64encode as b64e
6
+ from qiniu .auth import digest
7
+
8
+ access_key = ""
9
+ secret_key = ""
10
+
11
+ target_url = ""
12
+ dest_bucket = ""
13
+ dest_key = ""
14
+
15
+ encoded_url = b64e (target_url )
16
+ dest_entry = "%s:%s" % (dest_bucket , dest_key )
17
+ encoded_entry = b64e (dest_entry )
18
+
19
+
20
+ api_host = "iovip.qbox.me"
21
+ api_path = "/fetch/%s/to/%s" % (encoded_url , encoded_entry )
22
+
23
+ mac = digest .Mac (access = access_key , secret = secret_key )
24
+ client = digest .Client (host = api_host , mac = mac )
25
+
26
+ ret , err = client .call (path = api_path )
27
+ if err is not None :
28
+ print "failed"
29
+ print err
30
+ else :
31
+ print "success"
Original file line number Diff line number Diff line change
1
+ #coding=utf-8
2
+ import sys
3
+ sys .path .insert (0 , "../../" )
4
+
5
+ from urllib import quote
6
+ from qiniu .auth import digest
7
+
8
+ access_key = ""
9
+ secret_key = ""
10
+
11
+ bucket = ""
12
+ key = ""
13
+ fops = ""
14
+ notify_url = ""
15
+ force = False
16
+
17
+ api_host = "api.qiniu.com"
18
+ api_path = "/pfop/"
19
+ body = "bucket=%s&key=%s&fops=%s¬ifyURL=%s" % \
20
+ (quote (bucket ), quote (key ), quote (fops ), quote (notify_url ))
21
+
22
+ body = "%s&force=1" % (body ,) if force is not False else body
23
+
24
+ content_type = "application/x-www-form-urlencoded"
25
+ content_length = len (body )
26
+
27
+ mac = digest .Mac (access = access_key , secret = secret_key )
28
+ client = digest .Client (host = api_host , mac = mac )
29
+
30
+ ret , err = client .call_with (path = api_path , body = body ,
31
+ content_type = content_type , content_length = content_length )
32
+ if err is not None :
33
+ print "failed"
34
+ print err
35
+ else :
36
+ print "success"
37
+ print ret
Original file line number Diff line number Diff line change
1
+ #coding=utf-8
2
+ import sys
3
+ sys .path .insert (0 , "../../" )
4
+
5
+ from base64 import urlsafe_b64encode as b64e
6
+ from qiniu .auth import digest
7
+
8
+ access_key = ""
9
+ secret_key = ""
10
+
11
+ bucket = ""
12
+ key = ""
13
+
14
+ entry = "%s:%s" % (bucket , key )
15
+ encoded_entry = b64e (entry )
16
+
17
+
18
+ api_host = "iovip.qbox.me"
19
+ api_path = "/prefetch/%s" % (encoded_entry ,)
20
+
21
+ mac = digest .Mac (access = access_key , secret = secret_key )
22
+ client = digest .Client (host = api_host , mac = mac )
23
+
24
+ ret , err = client .call (path = api_path )
25
+ if err is not None :
26
+ print "failed"
27
+ print err
28
+ else :
29
+ print "success"
You can’t perform that action at this time.
0 commit comments