@coroutine
    def run(self):
        """Run a crawler iteration"""
        http_client = AsyncHTTPClient()
        # request OVH availability API asynchronously
        try:
            response = yield http_client.fetch(self.API_URL, request_timeout=REQUEST_TIMEOUT)
        except __HOLE__ as ex:
            # Internal Server Error
            self.HTTP_ERRORS.append(ex)
            if len(self.HTTP_ERRORS) > 3:
                _logger.error("Too many HTTP Errors: %s", self.HTTP_ERRORS)
            return
        except Exception as gex:
            # Also catch other errors.
            _logger.error("Socket Error: %s", str(gex))
            return
        if self.HTTP_ERRORS:
            del self.HTTP_ERRORS[:]
        response_json = json.loads(response.body.decode('utf-8'))
        if not response_json or not response_json['answer']:
            return
        availability = response_json['answer']['availability']
        for item in availability:
            # get server type of availability item
            server_type = self.SERVER_TYPES.get(item['reference'])
            # return if this server type is not in mapping
            if not server_type:
                continue
            # make a flat list of zones where servers of this type are available
            available_zones = set([
                e['zone'] for e in item['zones']
                if e['availability'] not in ['unavailable', 'unknown']])
            _logger.debug('%s is available in %s', server_type, available_zones)
            # iterate over all regions and update availability states
            for region, places in self.REGIONS.items():
                server_available = bool(available_zones.intersection(places))
                state_id = '%s_available_in_%s' % (server_type, region)
                message = {
                    'title': "{0} is available".format(server_type),
                    'text': "Server {server} is available in {region}".format(
                        server=server_type, region=region.capitalize()),
                    'url': "http://www.kimsufi.com/en/index.xml"
                }
                if 'sys' in item['reference'] or 'bk' in item['reference']:
                    message['url'] = 'http://www.soyoustart.com/de/essential-server/'
                self.update_state(state_id, server_available, message)
dataset/ETHPy150Open MA3STR0/kimsufi-crawler/crawler.py/Crawler.run