Skip to content

Instantly share code, notes, and snippets.

@IanLeatherbury
Created February 20, 2018 20:21
Show Gist options
  • Save IanLeatherbury/1dc1af2f54cc28b22fe2b30e9253a816 to your computer and use it in GitHub Desktop.
Save IanLeatherbury/1dc1af2f54cc28b22fe2b30e9253a816 to your computer and use it in GitHub Desktop.
class Pokedex(object):
def __init__(self, pokemon):
self.pokemon = pokemon
class Pokemon(object):
def __init__(self,
prev_evolution="value",
name="",
img="value",
spawn_chance="value",
egg="value",
weaknesses="value",
weight="value",
height="value",
candy_count="value",
avg_spawns="value",
num="value",
candy="value",
spawn_time="value",
next_evolution="value",
multipliers="value",
type="value",
id="value"):
self.prev_evolution = prev_evolution
self.name = name
self.img = img
self.spawn_chance = spawn_chance
self.egg = egg
self.weaknesses = weaknesses
self.weight = weight
self.height = height
self.candy_count = candy_count
self.avg_spawns = avg_spawns
self.num = num
self.candy = candy
self.spawn_time = spawn_time
self.next_evolution = next_evolution
self.multipliers = multipliers
self.type = type
self.id = id
def pokedex_from_json(p):
return [Pokemon(**x) for x in p['pokemon']]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment