예제 #1
0
def main():
    # pprint used to help format output neatly.
    pp = pprint.PrettyPrinter(indent=2)
    while (True):
        print('Welcome!')
        print('1. Get data for a specific berry.')
        print('2. Get data for a specific Pokemon species.')
        print('3. Get a list of Pokemon or berries.')
        print('4. Exit program.')
        print('Enter a number corresponding to the options listed above...')
        x = (int)(input())
        if (x == 1):  # Berry data
            # Input can either be a specified berry name or id number (1-64).
            # Input will assume you are entering the correct information.
            # Note: As of now data for roseli berry, kee berry, and maranga berry cannot be accessed.
            berry = input(
                'Enter a berry name (ex. oran) or id number (1-64): ')
            loader = pb.berry(berry)
            berry_data = json.loads(getWebpage(loader))

            pp.pprint(berry_data)

        elif (x == 2):  # Pokémon species data. Note: Long output.
            # Input assumes you are entering the correct information.
            # As of now, according to the national pokedex, there are 893 Pokémon but that is subject to change.
            # Warning: long output.
            pokemon_species = input(
                'Enter a pokemon species (ex. wormadam) name or id number (1-893): '
            )
            loader = pb.pokemon_species(pokemon_species)
            pokemon_species_data = json.loads(getWebpage(loader))

            pp.pprint(pokemon_species_data)

        elif (x == 3):  # Pokémon or berry list
            # Input assumes you are entering the correct information.
            # Note: pokemon and berry are not the only groups that can be called and outputted asked for simplicity
            # Check documentation and for more information on what can be entered.
            # Warning: long output.
            # Not formatted neatly
            group_list = input('Enter "pokemon" or "berry": ')

            print(pb.APIResourceList(group_list))

        elif (x == 4):
            print('Have a nice day!')
            break

        else:
            print('Input invalid. Please try again.')
예제 #2
0
 def testClass_APIResourceList(self):
     self.assertIsInstance(pb.APIResourceList('berry', force_lookup=True),
                           pb.APIResourceList)
def browse():
    global data
    if not data:
        data = pb.APIResourceList("pokemon")

    return data
예제 #4
0
 def resource_list():
     return pb.APIResourceList('pokemon')
예제 #5
0
 def resource_list():
     return pb.APIResourceList('move')
예제 #6
0
 def resource_list():
     return pb.APIResourceList('type')
예제 #7
0
파일: pokemon.py 프로젝트: nukeop/Icarus
 async def pokemon(ctx):
     l = pb.APIResourceList('pokemon')
     poke = random.choice(list(l))
     poke = pb.NamedAPIResource('pokemon', poke['name'])
     embed = embed_pokemon(poke)
     await bot.say(None, embed=embed)
예제 #8
0
파일: pokemon.py 프로젝트: nukeop/Icarus
def random_item():
    l = pb.APIResourceList('item')
    item = random.choice(list(l))
    return pb.NamedAPIResource('item', item['name'])
예제 #9
0
 def setUp(self):
     self.berries = pb.APIResourceList('berry')
     self.contestEffects = pb.APIResourceList('contest-effect')