{"record":{"id":"acf8c34cce6e4347","repo":"NanmiCoder/MediaCrawler","slug":"baidutiebaclient-get-reached-maximum-retry-attem","errorCode":null,"errorMessage":"[BaiduTieBaClient.get] Reached maximum retry attempts, IP is blocked, please try a new IP proxy: {e}","messagePattern":"\\[BaiduTieBaClient\\.get\\] Reached maximum retry attempts, IP is blocked, please try a new IP proxy: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"media_platform/tieba/client.py","lineNumber":305,"sourceCode":"\n        \"\"\"\n        final_uri = uri\n        if isinstance(params, dict):\n            final_uri = (f\"{uri}?\"\n                         f\"{urlencode(params)}\")\n        try:\n            res = await self.request(method=\"GET\", url=f\"{self._host}{final_uri}\", return_ori_content=return_ori_content, **kwargs)\n            return res\n        except RetryError as e:\n            if self.ip_pool:\n                proxie_model = await self.ip_pool.get_proxy()\n                _, proxy = utils.format_proxy_info(proxie_model)\n                res = await self.request(method=\"GET\", url=f\"{self._host}{final_uri}\", return_ori_content=return_ori_content, proxy=proxy, **kwargs)\n                self.default_ip_proxy = proxy\n                return res\n\n            utils.logger.error(f\"[BaiduTieBaClient.get] Reached maximum retry attempts, IP is blocked, please try a new IP proxy: {e}\")\n            raise Exception(f\"[BaiduTieBaClient.get] Reached maximum retry attempts, IP is blocked, please try a new IP proxy: {e}\")\n\n    async def post(self, uri: str, data: dict, **kwargs) -> Dict:\n        \"\"\"\n        POST request with header signing\n        Args:\n            uri: Request route\n            data: Request body parameters\n\n        Returns:\n\n        \"\"\"\n        json_str = json.dumps(data, separators=(',', ':'), ensure_ascii=False)\n        return await self.request(method=\"POST\", url=f\"{self._host}{uri}\", data=json_str, **kwargs)\n\n    async def pong(self, browser_context: BrowserContext = None) -> bool:\n        \"\"\"\n        Check if login state is still valid\n        Uses Cookie detection instead of API calls to avoid detection","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/NanmiCoder/MediaCrawler/blob/d6f7c5bb906b6dac40ddf343ef9e26438a3de092/media_platform/tieba/client.py#L287-L323","documentation":"Raised by BaiduTieBaClient.get (media_platform/tieba/client.py:305) when the wrapped request exhausts all retry attempts (tenacity RetryError) and no IP pool is configured to fail over to a fresh proxy. The method catches RetryError, tries self.ip_pool.get_proxy(); only if that is unavailable does it log and re-raise. It means sustained request failure, most commonly IP-level blocking, not a transient glitch.","triggerScenarios":"A GET request failing repeatedly until the tenacity retry budget is exhausted, with self.ip_pool falsy (no proxy pool configured). With an ip_pool present the code silently retries via a proxy instead; the exception only surfaces when there is nowhere else to route.","commonSituations":"Default configuration without proxy support; long-running crawls whose egress IP eventually gets blocklisted; rate limiting combined with retries that all hit the same blocked IP.","solutions":["Configure an IP proxy pool on BaiduTieBaClient so the RetryError fallback path can rotate IPs","Reduce request rate (CRAWLER_MAX_SLEEP_SEC, crawl_interval) to avoid triggering the block in the first place","Restart the crawl from a different network/IP after the block cools down","Refresh cookies via re-login if the block is account-bound rather than IP-bound"],"exampleFix":"# before\nclient = BaiduTieBaClient()  # no ip_pool\n\n# after\nfrom proxy import IpPool  # project proxy provider\nip_pool = IpPool()\nclient = BaiduTieBaClient(ip_pool=ip_pool)","handlingStrategy":"fallback","validationCode":"if client.ip_pool is None:\n    # every retry will hit the same IP; configure a pool or slow down before starting\n    set_higher_crawl_interval()","typeGuard":null,"tryCatchPattern":"from tenacity import RetryError\n\ntry:\n    res = await client.get(uri, params=params)\nexcept RetryError as e:\n    raise RuntimeError(\"Tieba rate-limited this IP; configure ip_pool or change IP\") from e","preventionTips":["Configure an ip_pool on BaiduTieBaClient for any sustained Tieba crawling","Catch tenacity.RetryError at the crawl-orchestration layer and rotate IP / pause","Budget request rates so the retry budget isn't burned on a pre-blocked IP"],"tags":["retry","proxy","tieba","rate-limit","network"],"backgroundTag":null,"analyzedSha":"d6f7c5bb906b6dac40ddf343ef9e26438a3de092","analyzedAt":"2026-08-15T01:39:07.505Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}