From 57a5644fc0f7b4eac0e19173edf0f9b23443ca84 Mon Sep 17 00:00:00 2001 From: xushiwei Date: Wed, 27 Jun 2012 18:05:51 +0800 Subject: [PATCH] user defined: QBOX_ACCESS_KEY, QBOX_SECRET_KEY --- qbox/config.dev.py | 24 ------------------------ qbox/config.local.py | 24 ------------------------ qbox/config.pro.py | 9 ++------- qbox/rs.py | 2 -- qbox/rs_demo.py | 20 +++++++++----------- 5 files changed, 11 insertions(+), 68 deletions(-) delete mode 100644 qbox/config.dev.py delete mode 100644 qbox/config.local.py diff --git a/qbox/config.dev.py b/qbox/config.dev.py deleted file mode 100644 index 3b40bb1d..00000000 --- a/qbox/config.dev.py +++ /dev/null @@ -1,24 +0,0 @@ -# -# OAuth2 - -ACCESS_KEY ="Please apply your access key" -SECRET_KEY ="Dont send your secret key to anyone" - -REDIRECT_URI = '' -AUTHORIZATION_ENDPOINT = '' -TOKEN_ENDPOINT = 'http://dev.qbox.us:9100/oauth2/token' - -# -# QBox - -PUT_TIMEOUT = 300000 # 300s = 5m - -IO_HOST = 'http://dev.qbox.us:9200' -FS_HOST = 'http://dev.qbox.us:9300' -RS_HOST = 'http://dev.qbox.us:10100' - -# -# Demo - -DEMO_DOMAIN = 'dev.qbox.us:9200' - diff --git a/qbox/config.local.py b/qbox/config.local.py deleted file mode 100644 index 2cfe58b1..00000000 --- a/qbox/config.local.py +++ /dev/null @@ -1,24 +0,0 @@ -# -# OAuth2 - -ACCESS_KEY ="Please apply your access key" -SECRET_KEY ="Dont send your secret key to anyone" - -REDIRECT_URI = '' -AUTHORIZATION_ENDPOINT = '' -TOKEN_ENDPOINT = 'http://127.0.0.1:9876/oauth2/token' - -# -# QBox - -PUT_TIMEOUT = 300000 # 300s = 5m - -IO_HOST = 'http://127.0.0.1:9876' -FS_HOST = 'http://127.0.0.1:9872' -RS_HOST = 'http://127.0.0.1:9875' - -# -# Demo - -DEMO_DOMAIN = 'localhost:9876' - diff --git a/qbox/config.pro.py b/qbox/config.pro.py index 348d56b1..60eea791 100644 --- a/qbox/config.pro.py +++ b/qbox/config.pro.py @@ -1,8 +1,8 @@ # # OAuth2 -ACCESS_KEY ="Please apply your access key" -SECRET_KEY ="Dont send your secret key to anyone" +ACCESS_KEY = '' +SECRET_KEY = '' REDIRECT_URI = '' AUTHORIZATION_ENDPOINT = '' @@ -17,8 +17,3 @@ FS_HOST = 'https://fs.qbox.me' RS_HOST = 'http://rs.qbox.me:10100' -# -# Demo - -DEMO_DOMAIN = 'iovip.qbox.me' - diff --git a/qbox/rs.py b/qbox/rs.py index 1df3447f..11403888 100644 --- a/qbox/rs.py +++ b/qbox/rs.py @@ -1,8 +1,6 @@ #coding=utf8 import config -import simpleoauth2 -import digestoauth from base64 import urlsafe_b64encode class Service: diff --git a/qbox/rs_demo.py b/qbox/rs_demo.py index 90761db4..ce7c3cea 100755 --- a/qbox/rs_demo.py +++ b/qbox/rs_demo.py @@ -1,12 +1,16 @@ #!/usr/bin/env python import urllib -import simpleoauth2 import digestoauth import rs as qboxrs import rscli import config +config.ACCESS_KEY = '' +config.SECRET_KEY = '' + +DEMO_DOMAIN = 'iovip.qbox.me/bucket' + client = digestoauth.Client() bucket = 'bucket' @@ -26,7 +30,7 @@ print '\n===> PutFile %s result:' % key print resp -resp = rs.Publish(config.DEMO_DOMAIN + '/' + bucket) +resp = rs.Publish(DEMO_DOMAIN) print '\n===> Publish result:' print resp @@ -45,13 +49,7 @@ print '\n===> Display %s contents:' % key print urllib.urlopen(resp['url']).read() -action='' -if action == 'delete': - resp = rs.Delete(key) - print '\n===> Delete %s result:' % key - print resp -elif action == 'drop': - resp = rs.Drop() - print '\n===> Drop table result:' - print resp +resp = rs.Delete(key) +print '\n===> Delete %s result:' % key +print resp