get account stats from wargamming

This commit is contained in:
vanzhiganov 2017-08-27 08:36:46 +03:00
parent fb6159f65d
commit 9129acd1a6
5 changed files with 48 additions and 9 deletions

View file

@ -13,7 +13,8 @@ def init_app():
app.config['OPENID_FS_STORE_PATH'] = 'tmp'
#
app.config['WG_ID'] = '502910c1c785c3c7ca2e83c9e89bde02'
app.config['WG_OPENID_URL'] = 'https://eu.wargaming.net/id/openid/'
# app.config['WG_OPENID_URL'] = 'https://eu.wargaming.net/id/openid/'
app.config['WG_OPENID_URL'] = 'https://wargaming.net/id/openid/'
# , safe_roots=[]
oid.init_app(app)

View file

@ -1,5 +1,35 @@
{% extends 'layouts/main.html' %}
{% block content %}
{{account_statistics}}
{# {account_statistics} #}
<ul>
{% for z in account_statistics %}
<li>{{ z }}
{% if account_statistics[z] is mapping %}
<ul>
{% for x in account_statistics[z] %}
<li>{{ x }}
{% if account_statistics[z][x] is mapping %}
<ul>
{% for c in account_statistics[z][x] %}
<li>{{ c }}: {{ account_statistics[z][x][c] }}</li>
{% endfor %}
</ul>
{% else %}
<ul>
<li>{{ x }}: {{ account_statistics[z][x] }}</li>
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
{% else %}
{{ account_statistics[z] }}
{% endif %}
</li>
{% endfor %}
</ul>
{% endblock %}

View file

@ -2,12 +2,12 @@
{% block title %}Create Profile{% endblock %}
{% block content %}
<h2>Sign in</h2>
<form action="" method=post>
<form action="" method="post">
{% if error %}<p class=error><strong>Error:</strong> {{ error }}</p>{% endif %}
<p>
OpenID:
<input type=text name=openid size=30>
<input type=submit value="Sign in">
<input type=hidden name=next value="{{ next }}">
Wargaming OpenID:
<input type="hidden" name="openid" value="{{ config['WG_OPENID_URL'] }}">
<input type="submit" value="Sign in">
<input type="hidden" name="next" value="{{ next }}">
</form>
{% endblock %}

View file

@ -25,11 +25,19 @@ def __get_player_personal_data():
@pages_account.route('/')
def index():
if not g.user:
return redirect(url_for('pages_home.index'))
account_statistics = __get_player_personal_data()
return render_template('pages/account/index.html', account_statistics=account_statistics)
return render_template(
'pages/account/index.html',
account_statistics=account_statistics)
@pages_account.route('/statistics.html')
def statistics():
if not g.user:
return redirect(url_for('pages_home.index'))
return render_template(
'pages/account/statistics.html')

View file

@ -30,7 +30,7 @@ def parse_wargaming_openid_url(url):
@pages_home.route('/', defaults={'page': 'index'})
@pages_home.route('/<page>')
def index(page):
z = session['openid']
# z = session['openid']
return render_template('pages/index.html')