oauth/client.py
changeset 63 6bfac7c633a0
parent 32 eb9e83610c99
equal deleted inserted replaced
62:2d3dd0824e8c 63:6bfac7c633a0
    58 @app.route('/renkan-request')
    58 @app.route('/renkan-request')
    59 def renkan_request():
    59 def renkan_request():
    60     if 'remote_oauth_clientcredentials' in session:
    60     if 'remote_oauth_clientcredentials' in session:
    61         resp = requests.post(
    61         resp = requests.post(
    62             app.config["CREATE_RENKAN_ENDPOINT"]+"?act_as="+str(session.get("me_id", "anonymous")), 
    62             app.config["CREATE_RENKAN_ENDPOINT"]+"?act_as="+str(session.get("me_id", "anonymous")), 
    63             {"title": "RENKAN_FROM_GED"},
    63             json.dumps({"title": "RENKAN_FROM_GED"}),
    64             headers={
    64             headers={
    65                 'Authorization': 'Bearer %s' % session['remote_oauth_clientcredentials'][0],
    65                 'Authorization': 'Bearer %s' % session['remote_oauth_clientcredentials'][0],
    66                 'renkan-act-as': session.get("me_id", "anonymous")
    66                 'renkan-act-as': session.get("me_id", "anonymous"),
       
    67                 'content-type': "application/json"
    67             }
    68             }
    68         )
    69         )
    69         print(resp.text)
    70         print("%r : %r" %(resp.status_code, json.loads(resp.text)))
    70     return redirect('/')
    71     return redirect('/')
    71 
    72 
    72 @app.route('/authorized')
    73 @app.route('/authorized')
    73 def authorized():
    74 def authorized():
    74     resp = remote.authorized_response()
    75     resp = remote.authorized_response()