Example #1
0
def auth_back():
    code = req.args.get('code')
    SessionCredStorage().put(oa2flow.step2_exchange(code))
    # Grabbing and storing user identity
    cred = SessionCredStorage().get()
    path = "https://login.eveonline.com/oauth/verify"
    http = httplib2.Http()
    http = cred.authorize(http)
    (header, content) = http.request("%s" % (path), "GET")
    session['user'] = pickle.dumps(User.from_json(content))
    # Back home
    return redirect(url_for("index"))
Example #2
0
def verify():
    cred = SessionCredStorage().get()
    path = "https://login.eveonline.com/oauth/verify"
    http = httplib2.Http()
    http = cred.authorize(http)
    (header, content) = http.request("%s" % (path), "GET")
    data = json.loads(content)
    print(data.get("CharacterName", "Unknown"))
    return "<pre>%s<hr>%s" % (
        json.dumps(header, indent=4),
        json.dumps(json.loads(content), indent=4)
    )
Example #3
0
def api_get():
    cred = SessionCredStorage().get()
    path = req.args.get('path')
    if not path:
        return abort(400)
    http = httplib2.Http()
    http = cred.authorize(http)
    (header, content) = http.request("%s%s" % (ROOT_URL, path), "GET")
    return jsonify(header=header, data=json.loads(content))
    return "<pre>%s<hr>%s" % (
        json.dumps(header, indent=4),
        json.dumps(json.loads(content), indent=4)
    )
Example #4
0
def cred():
    cred = SessionCredStorage().get()
    return "<pre>%s</pre>" % (
        json.dumps(json.loads(cred.to_json()), indent=4)
    )