File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313from urlparse import parse_qs
1414import urlparse
1515from requests_oauthlib import OAuth1 , OAuth1Session
16- #BASE_URL = "http://10.30.239.237:8080/oauth"
1716BASE_URL = 'http://10.30.239.237:8080/v1'
1817BASE_URL_OAUTH = "http://10.30.239.237:8080/oauth"
1918CLIENT_KEY = "b3af4e669daf880fb16563e6f36051b105188d413"
@@ -286,15 +285,13 @@ def delete_file():
286285def get_folder ():
287286 headers = {}
288287 folder_id = raw_input ("Folder id: " )
289- url = BASE_URL + '/folder/' + str (folder_id )+ '/contents'
290- #url ='http://localhost:8080/v1/file/578/data'
291- #url ='http://localhost:8080/v1/file?name=tiririri.txt'
288+ if folder_id and folder_id != 0 :
289+ url = BASE_URL + '/folder/' + str (folder_id )+ '/contents'
290+ else : # if no folder_id provided -> list root
291+ url = BASE_URL + '/folder/0'
292292
293- # uri, headers, _ = client.sign(url,
294- # http_method='GET')
295293 headers ['StackSync-API' ] = "v2"
296294
297- #headers['Content-Type'] = "text/plain"
298295 r = requests .get (url , headers = headers , auth = oauth )
299296 print 'response status' , r
300297 print 'response' , r .text
You can’t perform that action at this time.
0 commit comments