2017-12-29 14 views
0

저는 파이썬과 django에서 초보자입니다. django 설치하려고 Dropbox하지만 오류가 계속 "BadRequestException '개체에'get '"속성이 없습니다. 여기 내 코드가있다.오류 받기 'BadRequestException'객체에 'get'속성이 없습니다.

def get_dropbox_auth_flow(web_app_session): 
    APP_KEY= '****' 
    APP_SECRET = '****' 
    redirect_uri = "http://localhost:8000/dropbox" 
    return DropboxOAuth2Flow(APP_KEY, APP_SECRET, redirect_uri, web_app_session, "dropbox-auth-csrf-token") 

# URL handler for /dropbox-auth-start 
def dropbox_auth_start(request): 
    authorize_url = get_dropbox_auth_flow(request.session).start() 
    return HttpResponseRedirect(authorize_url) 

# URL handler for /dropbox-auth-finish 
def dropbox_auth_finish(request): 
    try: 
     access_token, user_id, url_state = get_dropbox_auth_flow(request.session).finish(request.GET) 
     # oauth_result = get_dropbox_auth_flow(request.session).finish(request.query_params) 
    except oauth.BadRequestException as e: 
     return e 
    except oauth.BadStateException as e: 
     # Start the auth flow again. 
     return HttpResponseRedirect("http://localhost:8000/dropbox_auth_start") 
    except oauth.CsrfException as e: 
     return HttpResponseForbidden() 
    except oauth.NotApprovedException as e: 
     raise e 
    except oauth.ProviderException as e: 
     raise e 

나는 당신이 raise e을 다른 모든 예외에 대한 문서 here

추가 추적 here

+0

아마도'request.get()'을 의미할까요? 이것이 함수 호출이기 때문에 괄호가 필요합니다. – pault

+1

질문에 전체 추적을 포함하십시오. – Galen

+0

@Galen은 원래의 질문에 추적을 추가했습니다 –

답변

0

다음,하지만 BadRequestException을 위해 당신이 그것을 반환 - 따라서 오류가 발생했습니다.

이 모든 작업은 매우 이상한 작업입니다. 예외를 잡기 위해서만 예외를 잡을 필요는 없습니다. BadStateException 및 CsrfException과 같이 실제로 처리하려는 것들만 잡아야합니다. 다른 블록을 모두 제거해야합니다.