2016-08-16 20:16:22 +00:00
|
|
|
import asyncio
|
|
|
|
import requests
|
|
|
|
loop = asyncio.get_event_loop()
|
|
|
|
|
|
|
|
# Get ladder page for a player
|
|
|
|
async def get_leaderboard_for(name: str):
|
2016-08-19 12:03:25 +00:00
|
|
|
print("[Brawlhalla] Getting leaderboards page for: {name}".format(name=name))
|
2016-08-16 20:16:22 +00:00
|
|
|
# Get leaderboards page for that name
|
2016-08-17 21:46:58 +00:00
|
|
|
r = await loop.run_in_executor(None, requests.get,
|
|
|
|
"http://www.brawlhalla.com/rankings/1v1/eu/?p={name}".format(name=name))
|
2016-08-16 20:16:22 +00:00
|
|
|
# Check if the request is successful
|
|
|
|
if r.status_code == 200:
|
|
|
|
return r
|
|
|
|
else:
|
|
|
|
raise Exception("Something went wrong in the Brawlhalla request.")
|