Пример #1
0
def genDropbox(request, code):
    print(request.session.get('session'))
    dbox = DropboxService()
    sess = session.DropboxSession(appkeys.DROPBOX['key'], appkeys.DROPBOX['secret'], 'app_folder')
    oauth_token = sess.obtain_request_token()
    #url = 'https://www.dropbox.com/1/oauth/authorize?oauth_token={0}&oauth_callback={1}'.format(dbox.parseToken(oauth_token)[0],'http%3A%2F%2F169.229.99.129:1338/auth/'+ code + '/' + oauth_token.secret)
    url = 'https://www.dropbox.com/1/oauth/authorize?oauth_token={0}&oauth_callback={1}'.format(dbox.parseToken(oauth_token)[0],'http%3A%2F%2F169.229.99.129:1338/auth/'+ code + '/' + oauth_token.secret)
    return redirect(url)
Пример #2
0
def syncFromServer(request, roomNum):
    print(Student.objects)
    students = Student.objects.filter(session=roomNum)
    print("Filtered")
    print(students)
    server = serverSession()
    fileList = {}
    server.listFiles('/{0}'.format(roomNum))
    print(fileList)
    for key in fileList.keys():
        path = '{0}/{1}'.format(roomNum,key)
        filename = key
        ref = server.shareRef(path)
        for user in students:
            sess = DropboxService(user.accessToken, user.accessSecret)
            try:
                sess.newFolder('/{0}'.format(roomNum))
            except:
                pass
            sess.getRef(ref,path)
    return render_to_response('home.html')
Пример #3
0
def serverSession():
    dbox = DropboxService(serverToken, serverSecret)
    return dbox
Пример #4
0
def authenticate(request):
    global session
    sess = DropboxService()
    sessions.append(sess)
    return render_to_response('dbox.html',RequestContext(request,{"url":sessions[-1].url}))