Esempio n. 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.')
Esempio n. 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
Esempio n. 4
0
 def resource_list():
     return pb.APIResourceList('pokemon')
Esempio n. 5
0
 def resource_list():
     return pb.APIResourceList('move')
Esempio n. 6
0
 def resource_list():
     return pb.APIResourceList('type')
Esempio n. 7
0
 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)
Esempio n. 8
0
def random_item():
    l = pb.APIResourceList('item')
    item = random.choice(list(l))
    return pb.NamedAPIResource('item', item['name'])
Esempio n. 9
0
 def setUp(self):
     self.berries = pb.APIResourceList('berry')
     self.contestEffects = pb.APIResourceList('contest-effect')