PokemonGo-Bot icon indicating copy to clipboard operation
PokemonGo-Bot copied to clipboard

"self.api.get...." is returning None sometimes

Open FilipiMor opened this issue 10 years ago • 1 comments

Expected Behavior

api return required data

Actual Behavior

api return None

Steps to Reproduce

Let the boot run for some time, probably with some high latency, and it api calls will return None

Other Information

OS: Windows 10 - 64Bits Git Commit: #1193 but not restrict to.

"self.api.get...." is returning None sometimes, I'm trying to patch with 'while response is none', but it's getting ugly, some dev can help me?

a sample where I tried to patch using 'while' to check if it's None if response_dict try to use get before getting data it will crash the bot. ` def find_close_cells(self, lat, lng): cellid = get_cellid(lat, lng) timestamp = [0, ] * len(cellid)

    self.api.get_map_objects(
        latitude=f2i(lat),
        longitude=f2i(lng),
        since_timestamp_ms=timestamp,
        cell_id=cellid
    )
    response_dict = self.api.call()
    while response_dict is None:
        logger.log('ERROR, Getting Map Object', 'red')
        self.api.get_map_objects(
            latitude=f2i(lat),
            longitude=f2i(lng),
            since_timestamp_ms=timestamp,
            cell_id=cellid
        )
        response_dict = self.api.call()
    map_objects = response_dict.get('responses', {}).get('GET_MAP_OBJECTS', {})
    status = map_objects.get('status', None)`

FilipiMor avatar Jul 27 '16 16:07 FilipiMor

There is a PR that addresses this : #1148

glenncampioni avatar Jul 27 '16 18:07 glenncampioni