PokeAPI / pokebase

Python 3 wrapper for Pokéapi v2
BSD 3-Clause "New" or "Revised" License
286 stars 53 forks source link

Can't retrieve other sprites #35

Closed Lucaslhm closed 2 years ago

Lucaslhm commented 2 years ago

While trying to retrieve the official artwork for a pokemon using the example code provided, I received this error:

Traceback (most recent call last):
  File "C:\Users\10student\PycharmProjects\PokemonAPITest\main.py", line 3, in <module>
    s2 = pb.SpriteResource('pokemon', 1, other_sprites=True, official_artwork=True)
  File "C:\Users\10student\AppData\Local\Programs\Python\Python39\lib\site-packages\pokebase\interface.py", line 246, in __init__
    self._load()
  File "C:\Users\10student\AppData\Local\Programs\Python\Python39\lib\site-packages\pokebase\interface.py", line 251, in _load
    data = get_sprite(self.sprite_type, self.sprite_id, **self.__orginal_kwargs)
  File "C:\Users\10student\AppData\Local\Programs\Python\Python39\lib\site-packages\pokebase\api.py", line 71, in get_sprite
    data = _call_sprite_api(sprite_type, sprite_id, **kwargs)
  File "C:\Users\10student\AppData\Local\Programs\Python\Python39\lib\site-packages\pokebase\api.py", line 54, in _call_sprite_api
    response.raise_for_status()
  File "C:\Users\10student\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 960, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other-sprites/official-artwork/1.png

I ran this exact:

import pokebase as pb

s2 = pb.SpriteResource('pokemon', 1, other_sprites=True, official_artwork=True)

print(s2.path)
C-Garza commented 2 years ago

The example in the README is slightly wrong. The code was updated at some point, so instead of using other_sprites=True, it should be other=True. I'll submit a PR to change that since this keeps happening.