cache player retrieved from collection url
This commit is contained in:
parent
8bc3abdf4d
commit
1812553c9b
|
@ -30,7 +30,9 @@ def get_scream(username):
|
|||
return scream
|
||||
|
||||
def get_collection(collection_url):
|
||||
# TODO: should probably add collection cache
|
||||
response = requests.get(onomancer_url + collection_hook + urllib.parse.quote(collection_url))
|
||||
if response.status_code == 200:
|
||||
for player in response.json()['lineup'] + response.json()['rotation']:
|
||||
db.cache_stats(player['name'], json.dumps(player))
|
||||
|
||||
return json.dumps(response.json())
|
|
@ -749,8 +749,7 @@ def build_star_embed(player_json):
|
|||
embed.add_field(name=starkeys[key], value=embedstring, inline=False)
|
||||
return embed
|
||||
|
||||
def team_from_collection(collection_raw):
|
||||
newteam_json = json.loads(collection_raw)
|
||||
def team_from_collection(newteam_json):
|
||||
# verify collection against our own restrictions
|
||||
if len(newteam_json["fullName"]) > 30:
|
||||
raise CommandError("Team names have to be less than 30 characters! Try again.")
|
||||
|
|
Loading…
Reference in New Issue
Block a user