{"record":{"id":"0f416be8549b6264","repo":"xtekky/gpt4free","slug":"cloudscraper-library-is-required-for-yupp-provider","errorCode":null,"errorMessage":"cloudscraper library is required for Yupp provider | install it via 'pip install cloudscraper'","messagePattern":"cloudscraper library is required for Yupp provider \\| install it via 'pip install cloudscraper'","errorType":"exception","errorClass":"MissingRequirementsError","httpStatus":null,"severity":"error","filePath":"g4f/Provider/Yupp.py","lineNumber":573,"sourceCode":"            load_yupp_accounts(api_key)\n        else:\n            raise MissingAuthError(\n                \"No Yupp accounts configured. Set YUPP_API_KEY environment variable.\"\n            )\n        credits = await get_credits(create_scraper(), await get_best_yupp_account())\n        return {\"credits\": {\"remaining\": credits, \"total\": 5000}}\n\n    @classmethod\n    async def create_async_generator(\n        cls,\n        model: str,\n        messages: Messages,\n        proxy: str = None,\n        api_key: str = None,\n        **kwargs,\n    ) -> AsyncResult:\n        if not has_cloudscraper:\n            raise MissingRequirementsError(\n                \"cloudscraper library is required for Yupp provider | install it via 'pip install cloudscraper'\"\n            )\n        if not api_key:\n            api_key = AuthManager.load_api_key(cls)\n        if not api_key:\n            api_key = get_cookie_tokens()\n        if api_key:\n            load_yupp_accounts(api_key)\n            log_debug(f\"Yupp provider initialized with {len(YUPP_ACCOUNTS)} accounts\")\n        else:\n            raise MissingAuthError(\n                \"No Yupp accounts configured. Set YUPP_API_KEY environment variable.\"\n            )\n\n        conversation = kwargs.get(\"conversation\")\n        url_uuid = conversation.url_uuid if conversation else None\n        is_new_conversation = url_uuid is None\n","sourceCodeStart":555,"sourceCodeEnd":591,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/Yupp.py#L555-L591","documentation":"Raised as MissingRequirementsError at the top of Yupp.create_async_generator() when the optional cloudscraper package is absent. Yupp sits behind Cloudflare protection and uses cloudscraper-based sessions (create_scraper()) for every request, so the dependency is mandatory for chat generation even though the provider module itself imports lazily.","triggerScenarios":"Calling create_async_generator (any chat completion routed to Yupp) in an environment where 'import cloudscraper' failed at module load, i.e. has_cloudscraper is False.","commonSituations":"Installing g4f without the [all] / web extras; slim Docker images; dependency stripped by a lockfile or pruned virtualenv.","solutions":["pip install cloudscraper","Install the g4f extras that bundle scraping dependencies (e.g. pip install g4f[all])","Add cloudscraper to requirements.txt / pyproject dependencies for deployments that use Yupp","Pin a recent cloudscraper version so Cloudflare bypass rules are current"],"exampleFix":"# before\n# cloudscraper missing -> MissingRequirementsError\nresponse = await client.chat.completions.create(model='...', provider='Yupp', ...)\n\n# after (shell)\n# pip install cloudscraper","handlingStrategy":"validation","validationCode":"from g4f.Provider.Yupp import has_cloudscraper\n\ndef yupp_usable():\n    return has_cloudscraper and bool(os.getenv('YUPP_API_KEY') or get_cookie_tokens())","typeGuard":null,"tryCatchPattern":"try:\n    ...  # chat call routed to Yupp\nexcept MissingRequirementsError as e:\n    if 'cloudscraper' in str(e):\n        subprocess.run([sys.executable, '-m', 'pip', 'install', 'cloudscraper'])  # or disable provider","preventionTips":["Include cloudscraper in requirements for any deployment using Yupp","Gate Yupp behind has_cloudscraper in provider selection"],"tags":["yupp","dependencies","cloudscraper","installation"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}