Exemplo n.º 1
0
def send_map_request(api, position):
    try:
        api.set_position(*position)
        api.get_map_objects(latitude=f2i(position[0]),
                            longitude=f2i(position[1]),
                            since_timestamp_ms=TIMESTAMP,
                            cell_id=get_cellid(position[0], position[1]))
        return api.call()
    except Exception as e:
        log.warn("Uncaught exception when downloading map " + str(e))
        return False
Exemplo n.º 2
0
def map_request(api, position):
    try:
        api.set_position(*position)
        api.get_map_objects(latitude=f2i(position[0]),
                            longitude=f2i(position[1]),
                            since_timestamp_ms=TIMESTAMP,
                            cell_id=get_cellid(position[0], position[1]))
        return api.call()
    except Exception as e:
        log.warning('Exception while downloading map: %s', e)
        return False
Exemplo n.º 3
0
def send_map_request(api, position):
    try:
        api.set_position(*position)
        api.get_map_objects(latitude=f2i(position[0]),
                            longitude=f2i(position[1]),
                            since_timestamp_ms=TIMESTAMP,
                            cell_id=get_cellid(position[0], position[1]))
        return api.call()
    except Exception as e:
        log.warn("Uncaught exception when downloading map " + str(e))
        return False
Exemplo n.º 4
0
def send_map_request(api, position, args):
    try:
        login_if_necessary(args, position)

        api.set_position(*position)
        api.get_map_objects(latitude=f2i(position[0]),
                            longitude=f2i(position[1]),
                            since_timestamp_ms=TIMESTAMP,
                            cell_id=get_cellid(position[0], position[1]))
        return api.call()
    except Exception:  # make sure we dont crash in the main loop
        log.exception("Uncaught exception when downloading map")
        return False
Exemplo n.º 5
0
def search_async(args):
    num_steps = len(SearchConfig.COVER)

    login_if_necessary(args, (SearchConfig.ORIGINAL_LATITUDE, SearchConfig.ORIGINAL_LONGITUDE, 0))
    log.info("Starting scan of {} locations".format(num_steps))

    i = 1
    while len(queue) > 0:
        c = queue.pop()
        step_location = (c["lat"], c["lng"], 0)
        log.debug('Scanning step {:d} of {:d}.'.format(i, num_steps))
        log.debug('Scan location is {:f}, {:f}'.format(step_location[0], step_location[1]))

        login_if_necessary(args, step_location)
        error_throttle()

        api.set_position(*step_location)
        api.get_map_objects(latitude=f2i(step_location[0]),
                            longitude=f2i(step_location[1]),
                            since_timestamp_ms=TIMESTAMP,
                            cell_id=get_cellid(step_location[0], step_location[1]))
        api.call_async(callback)

        if SearchConfig.CHANGE:
            log.info("Changing scan location")
            SearchConfig.CHANGE = False
            queue.clear()
            queue.extend(SearchConfig.COVER)

        if (i%20 == 0):
            log.info(api._rpc._curl.stats())

        i += 1

    api.finish_async()
    log.info(api._rpc._curl.stats())
    api._rpc._curl.reset_stats()