Random Code: Pokémon of the Day Python script

Wrote this while bored, figured I’d toss it out there for anyone who cares. Gives you a different Pokemon, and its Pokedex entry, each day. The specific Pokemon is randomly chosen, with the current date as the seed value.

There are probably ways to make it better, but I’m heavily constrained by the JSON that I’m retrieving from pokeapi.co on this one and I don’t feel like putting in the effort.

#	Pokémon of the Day Python script
#	Copyright 2021 Takel
#
#	Redistribution and use in source and binary forms, with or without modification, are permitted provided
#	that the following conditions are met:
#
#	1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
#	following disclaimer.
#
#	2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
#	the following disclaimer in the documentation and/or other materials provided with the distribution.
#
#	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
#	WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
#	PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
#	ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
#	LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
#	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
#	TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#	ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import json, random, requests, time

#	get the date as an integer, which we will use as the RNG seed;
#	that way, it's a new pokémon each day and only each day, but
#	we're not just modulus-ing our way through the list
random.seed(time.strftime('%Y%m%d'))
pokeNum = random.randint(1, 898)

pokeJSON = json.loads(json.dumps(requests.get(f'https://pokeapi.co/api/v2/pokemon-species/{pokeNum}').json()))


def getPokemonTextAttribute(keytype, key):
    pokeVersion = ""
    latestVersion = ""
    for i in range(0, 500):		# there's no way to directly request a specific language from
								# the JSON, so I have to use a for loop to iterate through the
								# whole goddamn file

        # additional handling code for flavor text because national dex
        if keytype == "flavor_text_entries":
            versions = ["sword", "ultra-sun", "omega-ruby"]		# one of these three should have the
																# flavor text in the JSON; searching
																# for the most recent first
            for j in range(0, 3):
                value = versions[j]
                for k in range(0, 500):		# again, the API won't let me grab just a specific
											# language, so I have to loop through the whole thing
                    try:
                        if value == pokeJSON["flavor_text_entries"][k]["version"]["name"]:
                            latestVersion = value
                            break
                    except IndexError:  # if k exceeds the number of entries in the JSON,
										# start over with the next game version
                        break
                if latestVersion == value:
                    break
            pokeVersion = pokeJSON["flavor_text_entries"][i]["version"]["name"]

        pokeLang = pokeJSON[keytype][i]["language"]["name"]
        if pokeVersion == latestVersion and pokeLang == "en" and keytype == "flavor_text_entries":
            # we found the latest flavor text, and it's in english
            break
        elif pokeLang == "en" and keytype != "flavor_text_entries":
            # we found the requested key, and it's in english
            break

    # we didn't find what we need, iterate the for loop again

    return pokeJSON[keytype][i][key]


pokeName = getPokemonTextAttribute("names", "name")
pokeGenus = getPokemonTextAttribute("genera", "genus")
pokeDesc = getPokemonTextAttribute("flavor_text_entries", "flavor_text")

print("The Pokémon of the Day is...")
print()
print("#" + str(pokeNum) + ":", pokeName + ", the", pokeGenus)
print()
print(pokeDesc)