fixed issue with API not returning certain players, names need to be down-cased for the API
This commit is contained in:
parent
46c039bf77
commit
13cb7890c6
@ -1,8 +1,9 @@
|
|||||||
import requests, json, pprint, discord
|
import requests, json, pprint, discord
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
pp = pprint.PrettyPrinter(indent=4)
|
||||||
|
|
||||||
def get_player(player):
|
def get_player(player):
|
||||||
# try:
|
player = player.lower()
|
||||||
url = "https://battlefieldtracker.com/bfv/profile/origin/" + player + "/overview"
|
url = "https://battlefieldtracker.com/bfv/profile/origin/" + player + "/overview"
|
||||||
headers = { 'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)' }
|
headers = { 'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)' }
|
||||||
response = requests.get(url, headers=headers).text
|
response = requests.get(url, headers=headers).text
|
||||||
@ -49,7 +50,6 @@ def get_player(player):
|
|||||||
]
|
]
|
||||||
|
|
||||||
for stat in gameplay_stats:
|
for stat in gameplay_stats:
|
||||||
# print(stat)
|
|
||||||
embed.add_field(name="**%s**" % stats_overview[stat]['displayName'], value=stats_overview[stat]['displayValue'], inline=False)
|
embed.add_field(name="**%s**" % stats_overview[stat]['displayName'], value=stats_overview[stat]['displayValue'], inline=False)
|
||||||
# embed.add_field(name='Raw value', value=stats_overview[stat]['displayValue'], inline=True)
|
# embed.add_field(name='Raw value', value=stats_overview[stat]['displayValue'], inline=True)
|
||||||
# embed.add_field(name='Global Percentile', value=stats_overview[stat]['percentile'], inline=True)
|
# embed.add_field(name='Global Percentile', value=stats_overview[stat]['percentile'], inline=True)
|
||||||
@ -58,6 +58,4 @@ def get_player(player):
|
|||||||
# return 'nope'
|
# return 'nope'
|
||||||
|
|
||||||
# assault_stats = base_stat_blob['segments'][9]
|
# assault_stats = base_stat_blob['segments'][9]
|
||||||
# medic_stats = base_stat_blob['segments'][10]
|
# medic_stats = base_stat_blob['segments'][10]
|
||||||
|
|
||||||
# pp.pprint(medic_stats)
|
|
Loading…
x
Reference in New Issue
Block a user