diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 0ae2188d98..d57c2dd90c 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -302,8 +302,16 @@ def use_lucky_egg(self): def get_inventory(self): if self.latest_inventory is None: - self.api.get_inventory() - response = self.api.call() + retries = 0 + while True: + time.sleep((2**retries * 100) / 1000.0) + self.api.get_inventory() + response = self.api.call() + try: + get_inventory = response['responses']['GET_INVENTORY'] + break + except: + retries += 1 self.latest_inventory = response return self.latest_inventory diff --git a/pokemongo_bot/cell_workers/pokemon_transfer_worker.py b/pokemongo_bot/cell_workers/pokemon_transfer_worker.py index 096b3ba975..f3fdbc8616 100644 --- a/pokemongo_bot/cell_workers/pokemon_transfer_worker.py +++ b/pokemongo_bot/cell_workers/pokemon_transfer_worker.py @@ -64,8 +64,7 @@ def work(self): def _release_pokemon_get_groups(self): pokemon_groups = {} - self.api.get_player().get_inventory() - inventory_req = self.api.call() + inventory_req = self.bot.get_inventory() if inventory_req.get('responses', False) is False: return pokemon_groups