optimization
This commit is contained in:
parent
643fab371a
commit
417fdd9138
|
|
@ -48,7 +48,7 @@ async def index():
|
|||
data_dict[steamid]['steam_pic'] = steam_dict[steamid]['steam_pic']
|
||||
|
||||
|
||||
return render_template('steamids.html', data_dict = data_dict)
|
||||
return render_template('steamids.html', data_dict = data_dict , steam_dict = steam_dict, faceit_dict = faceit_dict)
|
||||
else:
|
||||
return render_template('index.html')
|
||||
|
||||
|
|
@ -75,11 +75,12 @@ def steamid_to_64bit(steamid):
|
|||
|
||||
async def loop_faceit_data(data_dict):
|
||||
faceit_dict = {}
|
||||
req =requests.Session()
|
||||
for steamid in data_dict:
|
||||
faceit_dict[steamid] = {}
|
||||
url = "https://open.faceit.com/data/v4/players?game=csgo&game_player_id=" + str(data_dict[steamid]['steamid64'])
|
||||
headers = { 'accept': 'application/json', 'Authorization' : 'Bearer ab46a7ab-6ab8-4c00-a8ff-41c0ff71d562' }
|
||||
faceit_response = requests.get(url, headers=headers)
|
||||
faceit_response = req.get(url, headers=headers)
|
||||
faceit_response_json = faceit_response.json()
|
||||
|
||||
|
||||
|
|
@ -94,11 +95,12 @@ async def loop_faceit_data(data_dict):
|
|||
return faceit_dict
|
||||
|
||||
async def loop_steam_data(data_dict):
|
||||
steam_dict = {}
|
||||
steam_dict = {}
|
||||
req =requests.Session()
|
||||
for steamid in data_dict:
|
||||
steam_dict[steamid] = {}
|
||||
steamurl ="https://steamcommunity.com/profiles/" + str(data_dict[steamid]['steamid64']) +"/?xml=1"
|
||||
steam_req = requests.get(steamurl)
|
||||
steam_req = req.get(steamurl)
|
||||
steamdict_funct = xmltodict.parse(steam_req.content)
|
||||
|
||||
steam_dict[steamid]['steam_name'] = steamdict_funct['profile']['steamID']
|
||||
|
|
|
|||
|
|
@ -4,30 +4,30 @@
|
|||
<div class="input-group">
|
||||
{%for steamid in data_dict%}
|
||||
<div class="card" >
|
||||
<img class="Steam-PB" src="{{data_dict[steamid]['steam_pic']}}" alt="Card image cap">
|
||||
<img class="Steam-PB" src="{{steam_dict[steamid]['steam_pic']}}" alt="Card image cap">
|
||||
<div class="card-body">
|
||||
<h3 class="STeam-Name">{{data_dict[steamid]['steam_name']}}</h3>
|
||||
<h3 class="Steam-Name">{{steam_dict[steamid]['steam_name']}}</h3>
|
||||
<p class="FaceIT-IMG">
|
||||
{% if data_dict[steamid]['faceit_acc'] == 'true' %}
|
||||
{% if data_dict[steamid]['faceit_level'] == 1 %}
|
||||
{% if faceit_dict[steamid]['faceit_acc'] == 'true' %}
|
||||
{% if faceit_dict[steamid]['faceit_level'] == 1 %}
|
||||
<img src="/static/faceit1.svg" alt="FaceIT Level 1" width="100" height="100">
|
||||
{% elif data_dict[steamid]['faceit_level'] == 2 %}
|
||||
{% elif faceit_dict[steamid]['faceit_level'] == 2 %}
|
||||
<img src="/static/faceit2.svg" alt="FaceIT Level 2" width="100" height="100">
|
||||
{% elif data_dict[steamid]['faceit_level'] == 3 %}
|
||||
{% elif faceit_dict[steamid]['faceit_level'] == 3 %}
|
||||
<img src="/static/faceit3.svg" alt="FaceIT Level 3" width="100" height="100">
|
||||
{% elif data_dict[steamid]['faceit_level'] == 4 %}
|
||||
{% elif faceit_dict[steamid]['faceit_level'] == 4 %}
|
||||
<img src="/static/faceit4.svg" alt="FaceIT Level 4" width="100" height="100">
|
||||
{% elif data_dict[steamid]['faceit_level'] == 5 %}
|
||||
{% elif faceit_dict[steamid]['faceit_level'] == 5 %}
|
||||
<img src="/static/faceit5.svg" alt="FaceIT Level 5" width="100" height="100">
|
||||
{% elif data_dict[steamid]['faceit_level'] == 6 %}
|
||||
{% elif faceit_dict[steamid]['faceit_level'] == 6 %}
|
||||
<img src="/static/faceit6.svg" alt="FaceIT Level 6" width="100" height="100">
|
||||
{% elif data_dict[steamid]['faceit_level'] == 7 %}
|
||||
{% elif faceit_dict[steamid]['faceit_level'] == 7 %}
|
||||
<img src="/static/faceit7.svg" alt="FaceIT Level 7" width="100" height="100">
|
||||
{% elif data_dict[steamid]['faceit_level'] == 8 %}
|
||||
{% elif faceit_dict[steamid]['faceit_level'] == 8 %}
|
||||
<img src="/static/faceit8.svg" alt="FaceIT Level 8" width="100" height="100">
|
||||
{% elif data_dict[steamid]['faceit_level'] == 9 %}
|
||||
{% elif faceit_dict[steamid]['faceit_level'] == 9 %}
|
||||
<img src="/static/faceit9.svg" alt="FaceIT Level 9" width="100" height="100">
|
||||
{% elif data_dict[steamid]['faceit_level'] == 10 %}
|
||||
{% elif faceit_dict[steamid]['faceit_level'] == 10 %}
|
||||
<img src="/static/faceit10.svg" alt="FaceIT Level 10" width="100" height="100">
|
||||
{% endif %}
|
||||
{% else %}
|
||||
|
|
@ -37,14 +37,14 @@
|
|||
</div>
|
||||
{% if data_dict[steamid]['faceit_acc'] == 'true' %}
|
||||
<div class="Faceit-elo-and-steamid64">
|
||||
<p class="FaceIT-elo">FaceIT ELO: {{data_dict[steamid]['faceit_elo']}}</p>
|
||||
<p class="FaceIT-elo">FaceIT ELO: {{faceit_dict[steamid]['faceit_elo']}}</p>
|
||||
<p class="SteamID64">SteamID: {{data_dict[steamid]['steamid64']}}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="profile-links">
|
||||
<a href="https://steamcommunity.com/profiles/{{data_dict[steamid]['steamid64']}}" class="card-link">Steam Profile</a>
|
||||
<a href="https://steamcommunity.com/profiles/{{steam_dict[steamid]['steamid64']}}" class="card-link">Steam Profile</a>
|
||||
{% if data_dict[steamid]['faceit_acc'] == 'true' %}
|
||||
<a href="https://www.faceit.com/en/players/{{data_dict[steamid]['faceit_name']}}" class="card-link">FaceIT Link</a>
|
||||
<a href="https://www.faceit.com/en/players/{{faceit_dict[steamid]['faceit_name']}}" class="card-link">FaceIT Link</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue