{"id":15012841,"url":"https://github.com/daijro/browserforge","last_synced_at":"2025-04-10T04:48:43.106Z","repository":{"id":227412487,"uuid":"771324666","full_name":"daijro/browserforge","owner":"daijro","description":"🎭 Intelligent browser header \u0026 fingerprint generator","archived":false,"fork":false,"pushed_at":"2025-03-20T18:55:47.000Z","size":64,"stargazers_count":480,"open_issues_count":9,"forks_count":24,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-04-03T02:35:15.587Z","etag":null,"topics":["browsers","fingerprinting","headers","networking","playwright","python","requests","scraping"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/browserforge","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daijro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-13T04:56:46.000Z","updated_at":"2025-04-01T09:21:41.000Z","dependencies_parsed_at":"2024-03-15T08:24:33.624Z","dependency_job_id":"45db0811-b46f-4072-a10b-328c56c34db2","html_url":"https://github.com/daijro/browserforge","commit_stats":{"total_commits":13,"total_committers":2,"mean_commits":6.5,"dds":"0.23076923076923073","last_synced_commit":"2c905ff3dcf70d6991d334f4a92a4ff3454261f9"},"previous_names":["daijro/browserforge"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daijro%2Fbrowserforge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daijro%2Fbrowserforge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daijro%2Fbrowserforge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daijro%2Fbrowserforge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daijro","download_url":"https://codeload.github.com/daijro/browserforge/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161242,"owners_count":21057552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browsers","fingerprinting","headers","networking","playwright","python","requests","scraping"],"created_at":"2024-09-24T19:43:18.880Z","updated_at":"2025-04-10T04:48:43.085Z","avatar_url":"https://github.com/daijro.png","language":"Python","readme":"\u003ch1 align=\"center\"\u003e\n    BrowserForge\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/daijro/browserforge/blob/main/LICENSE\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/license/daijro/browserforge.svg?color=yellow\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://python.org/\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/python-3.8\u0026#8208;3.12-blue\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/browserforge/\"\u003e\n        \u003cimg alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/browserforge.svg?color=orange\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pepy.tech/project/browserforge\"\u003e\n        \u003cimg alt=\"PyPI\" src=\"https://static.pepy.tech/badge/browserforge\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/ambv/black\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/code%20style-black-black.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/PyCQA/isort\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/imports-isort-yellow.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://mypy-lang.org\"\u003e\n        \u003cimg src=\"http://www.mypy-lang.org/static/mypy_badge.svg\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch4 align=\"center\"\u003e\n    🎭 Intelligent browser header \u0026 fingerprint generator\n\u003c/h4\u003e\n\n---\n\n## What is it?\n\nBrowserForge is a browser header and fingerprint generator that mimics the frequency of different browsers, operating systems, and devices found in the wild.\n\nIt is a reimplementation of [Apify's fingerprint-suite](https://github.com/apify/fingerprint-suite) in Python.\n\n## Features\n\n- Uses a Bayesian generative network to mimic actual web traffic\n- Extremely fast runtime (0.1-0.2 miliseconds)\n- Easy and simple for humans to use\n- Extensive customization options for browsers, operating systems, devices, locales, and HTTP version\n- Written with type safety\n\n## Installation\n\n```\npip install browserforge[all]\n```\n## Usage\n\n## Generating Headers\n\n### Simple usage\n\n```py\n\u003e\u003e\u003e from browserforge.headers import HeaderGenerator\n\u003e\u003e\u003e headers = HeaderGenerator()\n\u003e\u003e\u003e headers.generate()\n{'sec-ch-ua': '\"Chromium\";v=\"122\", \"Not(A:Brand\";v=\"24\", \"Google Chrome\";v=\"122\"', 'Sec-Ch-Ua-Mobile': '?0', 'Sec-Ch-Ua-Platform': '\"Windows\"', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', 'Sec-Fetch-Site': '?1', 'Sec-Fetch-Mode': 'same-site', 'Sec-Fetch-User': 'document', 'Sec-Fetch-Dest': 'navigate', 'Accept-Encoding': 'gzip, deflate, br, zstd', 'Accept-Language': 'en-US;q=1.0'}\n```\n\n### Using with requests\n\nHeaders can be added to a session in [requests](https://github.com/psf/requests) (or similar libraries) by assigning them to the `headers` attribute:\n\n```py\nimport requests\nsession = requests.Session()\n# Set the session headers\nsession.headers = headers.generate()\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eParameters for HeaderGenerator\u003c/summary\u003e\n\n```\nParameters:\n    browser (Union[ListOrString, Iterable[Browser]], optional): Browser(s) or Browser object(s).\n    os (ListOrString, optional): Operating system(s) to generate headers for.\n    device (ListOrString, optional): Device(s) to generate the headers for.\n    locale (ListOrString, optional): List of at most 10 languages for the Accept-Language header. Default is 'en-US'.\n    http_version (Literal[1, 2], optional): Http version to be used to generate headers. Defaults to 2.\n    strict (bool, optional): Throws an error if it cannot generate headers based on the input. Defaults to False.\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eParameters for HeaderGenerator.generate\u003c/summary\u003e\n\n```\nGenerates headers using the default options and their possible overrides.\n\nParameters:\n    browser (Optional[Iterable[Union[str, Browser]]], optional): Browser(s) to generate the headers for.\n    os (Optional[ListOrString], optional): Operating system(s) to generate the headers for.\n    device (Optional[ListOrString], optional): Device(s) to generate the headers for.\n    locale (Optional[ListOrString], optional): Language(s) to include in the Accept-Language header.\n    http_version (Optional[Literal[1, 2]], optional): HTTP version to be used to generate headers.\n    user_agent (Optional[ListOrString], optional): User-Agent(s) to use.\n    request_dependent_headers (Optional[Dict[str, str]], optional): Known values of request-dependent headers.\n    strict (Optional[bool], optional): If true, throws an error if it cannot generate headers based on the input.\n```\n\n\u003c/details\u003e\n\n### Constraining headers\n\n#### Single constraint\n\nSet constraints for browsers by passing the optional strings below:\n\n```py\nheaders = HeaderGenerator(\n    browser='chrome',\n    os='windows',\n    device='desktop',\n    locale='en-US',\n    http_version=2\n)\n```\n\n#### Multiple constraints\n\nSet multiple constraints to select from. Options are selected based on their actual frequency in the wild:\n\n```py\nheaders = HeaderGenerator(\n    browser=('chrome', 'firefox', 'safari', 'edge'),\n    os=('windows', 'macos', 'linux', 'android', 'ios'),\n    device=('desktop', 'mobile'),\n    locale=('en-US', 'en', 'de'),\n    http_version=2\n)\n```\n\n#### Browser specifications\n\nSet specificiations for browsers, including version ranges and HTTP version:\n\n```py\nfrom browserforge.headers import Browser\n\nbrowsers = [\n    Browser(name='chrome', min_version=100, max_version=110),\n    Browser(name='firefox', max_version=80, http_version=1),\n    Browser(name='edge', min_version=95),\n]\nheaders = HeaderGenerator(browser=browsers)\n```\n\nNote that all constraints passed into the `HeaderGenerator` constructor can be overridden by passing them into the `generate` method.\n\n#### Generate headers given User-Agent\n\nHeaders can be generated given an existing user agent:\n\n```py\n\u003e\u003e\u003e headers.generate(user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36')\n```\n\nSelect from multiple User-Agents based on their frequency in the wild:\n\n```py\n\u003e\u003e\u003e headers.generate(user_agent=(\n    'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36',\n    'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0'\n))\n```\n\n\u003chr width=50\u003e\n\n## Generating Fingerprints\n\n### Simple usage\n\nInitialize FingerprintGenerator:\n\n```py\nfrom browserforge.fingerprints import FingerprintGenerator\nfingerprints = FingerprintGenerator()\nfingerprints.generate()\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eParameters for FingerprintGenerator\u003c/summary\u003e\n\n```\nParameters:\n    screen (Screen, optional): Screen constraints for the generated fingerprint.\n    strict (bool, optional): Whether to raise an exception if the constraints are too strict. Default is False.\n    mock_webrtc (bool, optional): Whether to mock WebRTC when injecting the fingerprint. Default is False.\n    slim (bool, optional): Disables performance-heavy evasions when injecting the fingerprint. Default is False.\n    **header_kwargs: Header generation options for HeaderGenerator\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eParameters for FingerprintGenerator.generate\u003c/summary\u003e\n\n```\nGenerates a fingerprint and a matching set of ordered headers using a combination of the default options specified in the constructor and their possible overrides provided here.\n\nParameters:\n    screen (Screen, optional): Screen constraints for the generated fingerprint.\n    strict (bool, optional): Whether to raise an exception if the constraints are too strict.\n    mock_webrtc (bool, optional): Whether to mock WebRTC when injecting the fingerprint. Default is False.\n    slim (bool, optional): Disables performance-heavy evasions when injecting the fingerprint. Default is False.\n    **header_kwargs: Additional header generation options for HeaderGenerator.generate\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eExample response\u003c/summary\u003e\n\n```\nFingerprint(screen=ScreenFingerprint(availHeight=784,\n                                     availWidth=1440,\n                                     availTop=25,\n                                     availLeft=0,\n                                     colorDepth=30,\n                                     height=900,\n                                     pixelDepth=30,\n                                     width=1440,\n                                     devicePixelRatio=2,\n                                     pageXOffset=0,\n                                     pageYOffset=0,\n                                     innerHeight=0,\n                                     outerHeight=718,\n                                     outerWidth=1440,\n                                     innerWidth=0,\n                                     screenX=0,\n                                     clientWidth=0,\n                                     clientHeight=19,\n                                     hasHDR=True),\n            navigator=NavigatorFingerprint(userAgent='Mozilla/5.0 (Macintosh; '\n                                                     'Intel Mac OS X 10_15_7) '\n                                                     'AppleWebKit/537.36 '\n                                                     '(KHTML, like Gecko) '\n                                                     'Chrome/121.0.0.0 '\n                                                     'Safari/537.36',\n                                           userAgentData={'architecture': 'arm',\n                                                          'bitness': '64',\n                                                          'brands': [{'brand': 'Not '\n                                                                               'A(Brand',\n                                                                      'version': '99'},\n                                                                     {'brand': 'Google '\n                                                                               'Chrome',\n                                                                      'version': '121'},\n                                                                     {'brand': 'Chromium',\n                                                                      'version': '121'}],\n                                                          'fullVersionList': [{'brand': 'Not '\n                                                                                        'A(Brand',\n                                                                               'version': '99.0.0.0'},\n                                                                              {'brand': 'Google '\n                                                                                        'Chrome',\n                                                                               'version': '121.0.6167.160'},\n                                                                              {'brand': 'Chromium',\n                                                                               'version': '121.0.6167.160'}],\n                                                          'mobile': False,\n                                                          'model': '',\n                                                          'platform': 'macOS',\n                                                          'platformVersion': '13.6.1',\n                                                          'uaFullVersion': '121.0.6167.160'},\n                                           doNotTrack=None,\n                                           appCodeName='Mozilla',\n                                           appName='Netscape',\n                                           appVersion='5.0 (Macintosh; Intel '\n                                                      'Mac OS X 10_15_7) '\n                                                      'AppleWebKit/537.36 '\n                                                      '(KHTML, like Gecko) '\n                                                      'Chrome/121.0.0.0 '\n                                                      'Safari/537.36',\n                                           oscpu=None,\n                                           webdriver=False,\n                                           language='en-US',\n                                           languages=['en-US'],\n                                           platform='MacIntel',\n                                           deviceMemory=8,\n                                           hardwareConcurrency=10,\n                                           product='Gecko',\n                                           productSub='20030107',\n                                           vendor='Google Inc.',\n                                           vendorSub=None,\n                                           maxTouchPoints=0,\n                                           extraProperties={'globalPrivacyControl': None,\n                                                            'installedApps': [],\n                                                            'isBluetoothSupported': False,\n                                                            'pdfViewerEnabled': True,\n                                                            'vendorFlavors': ['chrome']}),\n            headers={'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',\n                     'Accept-Encoding': 'gzip, deflate, br',\n                     'Accept-Language': 'en-US;q=1.0',\n                     'Sec-Fetch-Dest': 'navigate',\n                     'Sec-Fetch-Mode': 'same-site',\n                     'Sec-Fetch-Site': '?1',\n                     'Sec-Fetch-User': 'document',\n                     'Upgrade-Insecure-Requests': '1',\n                     'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X '\n                                   '10_15_7) AppleWebKit/537.36 (KHTML, like '\n                                   'Gecko) Chrome/121.0.0.0 Safari/537.36',\n                     'sec-ch-ua': '\"Not A(Brand\";v=\"99\", \"Google '\n                                  'Chrome\";v=\"121\", \"Chromium\";v=\"121\"',\n                     'sec-ch-ua-mobile': '?0',\n                     'sec-ch-ua-platform': '\"macOS\"'},\n            videoCodecs={'h264': 'probably', 'ogg': '', 'webm': 'probably'},\n            audioCodecs={'aac': 'probably',\n                         'm4a': 'maybe',\n                         'mp3': 'probably',\n                         'ogg': 'probably',\n                         'wav': 'probably'},\n            pluginsData={'mimeTypes': ['Portable Document '\n                                       'Format~~application/pdf~~pdf',\n                                       'Portable Document '\n                                       'Format~~text/pdf~~pdf'],\n                         'plugins': [{'description': 'Portable Document Format',\n                                      'filename': 'internal-pdf-viewer',\n                                      'mimeTypes': [{'description': 'Portable '\n                                                                    'Document '\n                                                                    'Format',\n                                                     'enabledPlugin': 'PDF '\n                                                                      'Viewer',\n                                                     'suffixes': 'pdf',\n                                                     'type': 'application/pdf'},\n                                                    {'description': 'Portable '\n                                                                    'Document '\n                                                                    'Format',\n                                                     'enabledPlugin': 'PDF '\n                                                                      'Viewer',\n                                                     'suffixes': 'pdf',\n                                                     'type': 'text/pdf'}],\n                                      'name': 'PDF Viewer'},\n                                     {'description': 'Portable Document Format',\n                                      'filename': 'internal-pdf-viewer',\n                                      'mimeTypes': [{'description': 'Portable '\n                                                                    'Document '\n                                                                    'Format',\n                                                     'enabledPlugin': 'Chrome '\n                                                                      'PDF '\n                                                                      'Viewer',\n                                                     'suffixes': 'pdf',\n                                                     'type': 'application/pdf'},\n                                                    {'description': 'Portable '\n                                                                    'Document '\n                                                                    'Format',\n                                                     'enabledPlugin': 'Chrome '\n                                                                      'PDF '\n                                                                      'Viewer',\n                                                     'suffixes': 'pdf',\n                                                     'type': 'text/pdf'}],\n                                      'name': 'Chrome PDF Viewer'},\n                                     {'description': 'Portable Document Format',\n                                      'filename': 'internal-pdf-viewer',\n                                      'mimeTypes': [{'description': 'Portable '\n                                                                    'Document '\n                                                                    'Format',\n                                                     'enabledPlugin': 'Chromium '\n                                                                      'PDF '\n                                                                      'Viewer',\n                                                     'suffixes': 'pdf',\n                                                     'type': 'application/pdf'},\n                                                    {'description': 'Portable '\n                                                                    'Document '\n                                                                    'Format',\n                                                     'enabledPlugin': 'Chromium '\n                                                                      'PDF '\n                                                                      'Viewer',\n                                                     'suffixes': 'pdf',\n                                                     'type': 'text/pdf'}],\n                                      'name': 'Chromium PDF Viewer'},\n                                     {'description': 'Portable Document Format',\n                                      'filename': 'internal-pdf-viewer',\n                                      'mimeTypes': [{'description': 'Portable '\n                                                                    'Document '\n                                                                    'Format',\n                                                     'enabledPlugin': 'Microsoft '\n                                                                      'Edge '\n                                                                      'PDF '\n                                                                      'Viewer',\n                                                     'suffixes': 'pdf',\n                                                     'type': 'application/pdf'},\n                                                                    'Document '\n                                                                    'Format',\n                                                     'enabledPlugin': 'Microsoft '\n                                                                      'Edge '\n                                                                      'PDF '\n                                                                      'Viewer',\n                                                     'suffixes': 'pdf',\n                                                     'type': 'text/pdf'}],\n                                      'name': 'Microsoft Edge PDF Viewer'},\n                                     {'description': 'Portable Document Format',\n                                      'filename': 'internal-pdf-viewer',\n                                      'mimeTypes': [{'description': 'Portable '\n                                                                    'Document '\n                                                                    'Format',\n                                                     'enabledPlugin': 'WebKit '\n                                                                      'built-in '\n                                                                      'PDF',\n                                                     'suffixes': 'pdf',\n                                                     'type': 'application/pdf'},\n                                                    {'description': 'Portable '\n                                                                    'Document '\n                                                                    'Format',\n                                                     'enabledPlugin': 'WebKit '\n                                                                      'built-in '\n                                                                      'PDF',\n                                                     'suffixes': 'pdf',\n                                                     'type': 'text/pdf'}],\n                                      'name': 'WebKit built-in PDF'}]},\n            battery={'charging': False,\n                     'chargingTime': None,\n                     'dischargingTime': 29940,\n                     'level': 0.98},\n            videoCard=VideoCard(renderer='ANGLE (Apple, ANGLE Metal Renderer: '\n                                         'Apple M2 Pro, Unspecified Version)',\n                                vendor='Google Inc. (Apple)'),\n            multimediaDevices={'micros': [{'deviceId': '',\n                                           'groupId': '',\n                                           'kind': 'audioinput',\n                                           'label': ''}],\n                               'speakers': [{'deviceId': '',\n                                             'groupId': '',\n                                             'kind': 'audiooutput',\n                                             'label': ''}],\n                               'webcams': [{'deviceId': '',\n                                            'groupId': '',\n                                            'kind': 'videoinput',\n                                            'label': ''}]},\n            fonts=['Arial Unicode MS', 'Gill Sans', 'Helvetica Neue', 'Menlo']\n            mockWebRTC: False,\n            slim: False)\n```\n\n\u003c/details\u003e\n\n### Constraining fingerprints\n\n#### Screen width/height\n\nConstrain the minimum/maximum screen width and height:\n\n```py\nfrom browserforge.fingerprints import Screen\n\nscreen = Screen(\n    min_width=100\n    max_width=1280\n    min_height=400\n    max_height=720\n)\n\nfingerprints = FingerprintGenerator(screen=screen)\n```\n\nNote: Not all bounds need to be defined.\n\n#### Browser specifications\n\n`FingerprintGenerator` and `FingerprintGenerator.generate` inherit the same parameters from `HeaderGenerator`.\n\nBecause of this, user agents, browser specifications, device types, and operating system constrains can also be passed into `FingerprintGenerator.generate`.\n\nHere is a usage example:\n\n```py\nfingerprint.generate(browser='chrome', os='windows')\n```\n\n\u003chr width=50\u003e\n\n## Injecting Fingerprints\n\n\u003e [!WARNING]\n\u003e Fingerprint injection in BrowserForge is deprecated. Please check out [Camoufox] instead.\n\nBrowserForge is fully compatible with your existing Playwright and Pyppeteer code. You only have to change your context/page initialization.\n\n### Playwright\n\n#### Async API:\n\n```py\n# Import the AsyncNewContext injector\nfrom browserforge.injectors.playwright import AsyncNewContext\n\nasync def main():\n    async with async_playwright() as playwright:\n        browser = await playwright.chromium.launch()\n        # Create a new async context with the injected fingerprint\n        context = await AsyncNewContext(browser, fingerprint=fingerprint)\n        page = await context.new_page()\n        ...\n```\n\nReplace `await browser.new_context` with `await AsyncNewContext` in your existing Playwright code.\n\n\u003cdetails\u003e\n\u003csummary\u003eParameters for AsyncNewContext\u003c/summary\u003e\n\n```\nInjects an async_api Playwright context with a Fingerprint.\n\nParameters:\n    browser (Browser): The browser to create the context in\n    fingerprint (Optional[Fingerprint]): The fingerprint to inject. If None, one will be generated\n    fingerprint_options (Optional[Dict]): Options for the Fingerprint generator if `fingerprint` is not passed\n    **new_context_options: Other options for the new context\n```\n\n\u003c/details\u003e\n\n#### Sync API:\n\n```py\n# Import the NewContext injector\nfrom browserforge.injectors.playwright import NewContext\n\ndef main():\n    with sync_playwright() as playwright:\n        browser = playwright.chromium.launch()\n        # Create a new context with the injected fingerprint\n        context = NewContext(browser, fingerprint=fingerprint)\n        page = context.new_page()\n        ...\n```\n\nReplace `browser.new_context` with `NewContext` in your existing Playwright code.\n\n\u003cdetails\u003e\n\u003csummary\u003eParameters for NewContext\u003c/summary\u003e\n\n```\nInjects a sync_api Playwright context with a Fingerprint.\n\nParameters:\n    browser (Browser): The browser to create the context in\n    fingerprint (Optional[Fingerprint]): The fingerprint to inject. If None, one will be generated\n    fingerprint_options (Optional[Dict]): Options for the Fingerprint generator if `fingerprint` is not passed\n    **new_context_options: Other options for the new context\n```\n\n\u003c/details\u003e\n\n#### Undetected-Playwright\n\n[Undetected-Playwright](https://github.com/kaliiiiiiiiii/undetected-playwright-python) is also supported in the `browserforge.injectors.undetected_playwright` package. The usage is the same as the Playwright injector.\n\n### Pyppeteer\n\n```py\n# Import the NewPage injector\nfrom browserforge.injectors.pyppeteer import NewPage\nfrom pyppeteer import launch\n\nasync def test():\n    browser = await launch()\n    # Create a new page with the injected fingerprint\n    page = await NewPage(browser, fingerprint=fingerprint)\n    ...\n```\n\nReplace `browser.newPage` with `NewPage` in your existing Pyppeteer code.\n\n\u003cdetails\u003e\n\u003csummary\u003eParameters for NewPage\u003c/summary\u003e\n\n```\nInjects a Pyppeteer browser object with a Fingerprint.\n\nParameters:\n    browser (Browser): The browser to create the context in\n    fingerprint (Optional[Fingerprint]): The fingerprint to inject. If None, one will be generated\n    fingerprint_options (Optional[Dict]): Options for the Fingerprint generator if `fingerprint` is not passed\n```\n\n\u003c/details\u003e\n\n\u003chr width=50\u003e\n\n## Uninstall\n\n```\npip uninstall browserforge\n```\n\n---\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaijro%2Fbrowserforge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaijro%2Fbrowserforge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaijro%2Fbrowserforge/lists"}