Skip to content

Pokemon

Sayad Uddin Tahsin edited this page Apr 9, 2023 · 2 revisions

The Pokemon category is a part of a library that provides information about Pokemon. With this category, you can get information on various aspects of Pokemon, including abilities, moves, items, and Pokedex entries.

class Ability

Get Pokemon ability information.

Parameters

  • ability (str): Ability name/id

Attributes

  • id (int): Ability ID
  • name (str): Ability Name
  • generation (int): Ability Generation
  • effects (str): Ability Effects
  • description (str): Ability Description
  • pokemons (list): Ability Pokemons
  • descriptions (str): Ability Descriptions (Versions)
  • raw (dict): The raw JSON response from the API.

Exceptions

  • APITimeout: Raised when the API takes too long to respond.
  • APIError: Raised when the API returns an error.

Example

from sra import pokemon

# Create a new instance of the Ability class
ability = others.Ability("1")

# Get the info (e.g. generation)
generation = ability.generation

class Item

Get Pokemon item information

Parameters

  • item (str): Item name/id

Attributes

  • id (int): Item ID
  • name (str): Item Name
  • effects (str): Item Effects
  • cost (int): Item Cost
  • attributes (list): Item Attributes
  • sprite (list): Item Sprites
  • descriptions (str): Item Descriptions (Versions)
  • raw (dict): The raw JSON response from the API.

Exceptions

  • APITimeout: Raised when the API takes too long to respond.
  • APIError: Raised when the API returns an error.

Example

from sra import pokemon

# Create a new instance of the Item class
item = others.Item("1")

# Get the info (e.g. sprite)
sprite = item.sprite

class Move

Get Pokemon move information

Parameters

  • move (str): Move name/id

Attributes

  • id (int): Move ID
  • name (str): Move Name
  • generation (int): Move Generation
  • effects (str): Move Effects
  • type (str): Move Description
  • category (list): Move Category
  • contest (str): Move Contest
  • pp (int): Move Contest
  • power (int): Move Contest
  • accuracy (int): Move Contest
  • priority (int): Move Contest
  • pokemon (list): Move Contest
  • descriptions (str): Move Descriptions (Description, Version)
  • raw (dict): The raw JSON response from the API.

Exceptions

  • APITimeout: Raised when the API takes too long to respond.
  • APIError: Raised when the API returns an error.

Example

from sra import pokemon

# Create a new instance of the Ability class
move = others.Move("1")

# Get the info (e.g. accuracy)
accuracy = move.accuracy

class Pokedex

Get Pokemon information

Parameters

  • ability (str): Pokedex name

Attributes

  • name (str): Pokedex Name
  • id (str): Pokedex ID
  • type (list): Pokedex Types
  • species (list): Pokedex Species
  • abilities (list): Pokedex Abilities
  • height (str): Pokedex Height
  • weight (str): Pokedex Weight
  • base_experience (str): Pokedex Base Experience
  • egg_groups (list): Pokedex Egg Groups
  • stats (class)
    • Attributes

      • hp (str): Stats HP
      • attack (str): Stats Attack
      • defense (str): Stats Defense
      • sp_atk (str): Stats SP Attack
      • sp_def (str): Stats SP Defense
      • speed (str): Stats Speed
      • total (str): Stats Total
      • raw (dict): The Stats raw JSON response from the API.
  • family (class)
    • Attributes

      • evolutionStage (str): Family Evolution Stage
      • evolutionLine (list): Family Evolution Line
      • raw (dict): The Family raw JSON response from the API.
  • sprites (class)
    • Attributes

      • normal (str): Sprite Normal
      • animated (list): Sprite Animated
      • raw (dict): The Sprites raw JSON response from the API.
  • description (str): Pokedex Description
  • generation (str): Pokedex generation
  • raw (dict): The raw JSON response from the API.

Exceptions

  • APITimeout: Raised when the API takes too long to respond.
  • APIError: Raised when the API returns an error.

Example

from sra import pokemon

# Create a new instance of the Pokedex class
ability = pokemon.Pokedex("pikachu")

# Get the info (e.g. weight, sprite (animated))
generation = ability.generation
sprite_animated = ability.sprites.animated
Clone this wiki locally