Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
FilipiMor opened this issue Jul 27, 2016 · 1 comment
Closed

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

FilipiMor opened this issue Jul 27, 2016 · 1 comment

Comments

@FilipiMor
Copy link
Contributor

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)`
@glennvgastel
Copy link
Contributor

There is a PR that addresses this : #1148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants