{"id":25155006,"url":"https://github.com/cfsession/cfsession","last_synced_at":"2025-07-28T21:08:41.585Z","repository":{"id":50116770,"uuid":"518533061","full_name":"CFSession/CFSession","owner":"CFSession","description":"A python script utilizing undetected-chromedriver to collect session cookies in a cloudflare IUAM protected site","archived":false,"fork":false,"pushed_at":"2024-12-07T12:42:01.000Z","size":7339,"stargazers_count":63,"open_issues_count":3,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-26T17:10:27.839Z","etag":null,"topics":["cloudflare-bypass","python","selenium","turnstile-bypass"],"latest_commit_sha":null,"homepage":"","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/CFSession.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"kinuseka","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":"kinuseka","thanks_dev":null,"custom":null}},"created_at":"2022-07-27T16:26:30.000Z","updated_at":"2025-06-15T18:01:27.000Z","dependencies_parsed_at":"2023-10-30T15:34:46.295Z","dependency_job_id":"7af4101c-125f-40b8-838f-2df824193939","html_url":"https://github.com/CFSession/CFSession","commit_stats":{"total_commits":210,"total_committers":2,"mean_commits":105.0,"dds":"0.16666666666666663","last_synced_commit":"634bf72de5c0c572192fcce49fff3021a490dcc2"},"previous_names":["cfsession/cfsession","kinuseka/cfsession"],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/CFSession/CFSession","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CFSession%2FCFSession","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CFSession%2FCFSession/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CFSession%2FCFSession/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CFSession%2FCFSession/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CFSession","download_url":"https://codeload.github.com/CFSession/CFSession/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CFSession%2FCFSession/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267585818,"owners_count":24111577,"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","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cloudflare-bypass","python","selenium","turnstile-bypass"],"created_at":"2025-02-09T00:19:38.151Z","updated_at":"2025-07-28T21:08:41.557Z","avatar_url":"https://github.com/CFSession.png","language":"Python","funding_links":["https://ko-fi.com/kinuseka","https://buymeacoffee.com/kinuseka"],"categories":[],"sub_categories":[],"readme":"\u003cH1 align=\"center\"\u003e\u003cb\u003eCFSession\u003c/b\u003e\u003c/p\u003e\u003c/H1\u003e\n\u003cp align=\"center\"\u003eA python script utilizing undetected-chromedriver to collect session cookies in a cloudflare IUAM protected site\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://pypi.org/project/CFSession\"\u003e\u003cimg src=\"https://github.com/Kinuseka/CFSession/actions/workflows/python-package.yml/badge.svg\" alt=\"Build Test\"\u003e\u003c/a\u003e\n\u003ca href=\"https://ko-fi.com/kinuseka\" target=\"_blank\"\u003e\u003cimg src=\"https://www.ko-fi.com/img/githubbutton_sm.svg\" alt=\"Ko-Fi\" height=\"20\" width=\"150\"\u003e\u003c/a\u003e\n\n\n## How it works\nIt relies on a modified selenium (undetected-chromedriver) to cloak on sites that block selenium based sessions. \nWhen a program is able to pass through the IUAM or Captcha verification, it immediately saves the session token to access the site using requests library.\n\nThe library wraps around requests library.\n\n**Supported request types:**\n* GET\n* POST\n* HEAD\n* PUT\n* PATCH\n* DELETE\n* OPTIONS\n\n[Read the wiki for a more extensive details\n](https://github.com/CFSession/CFSession/wiki)\n## Usage:\n\n### Normal Usage:\n\n```py\nimport CFSession\n\nif __name__ == \"__main__\": \n    session = CFSession.cfSession()\n    res = session.get(\"https://nowsecure.nl\") #A Cloudflare protected site\n    print(res.content)\n\n    #Context Manager\n    with CFSession.cfSession() as session:\n        res = session.get(\"https://nowsecure.nl\")\n        print(res.content)\n```\nenable headless mode:\n\n```py\nsession = CFSession.cfSession(headless_mode=True)\n```\n\n### How to choose chrome version:\n\nCFSession has `*args` and `**kwargs` which simply passes it to `uc.Chrome()`\n```py\nfrom CFSession import cfSession\n\nif __name__ == \"__main__\": \n    session = cfSession(version_main=95) #pick chrome version 95\n```\nYou can also use more options from `uc.Chrome()` and pass it from there \n\n### How to modify chrome options:\nV1.3.0 now supports a much more easier way of modifying chromeoptions\n```py\nfrom CFSession import Options, cfSession\nimport undetected_chromedriver as uc\n\noptions = Options()\noptions.chrome_options = uc.ChromeOptions()\nsession = cfSession(options=options)\n```\n#### Error correcting issues:\nSometimes a uc.Chrome() object has to refresh due to errors (e.g. network errors), the program tries to correct these errors by retrying again until a specified amount of attempts has reached, this operation requires recreating the class again.\nThese cause issues where we have to recreate the `ChromeOptions` as it is not reusable by selenium's standards. \n\nBy default, the program resets all user setting to our preferred default setting, however if you have a preferred setting on mind then you can ignore our defaults by\nsetting `ignore_defaults = True` on `Options`\n```py\noptions = Options(ignore_defaults=True)\n```\n\n## Installation:\n`python3 -m pip install CFSession`\n\n**or**\n\n`pip3 install CFSession`\n\n\n## Question: \n\n**Why not just scrape fully on selenium?** \n- There are some use cases that where some applications rely on a `requests` library to scrape on websites, while selenium is sensible option to prevent javascript challenges. This library will try and bypass javascript challenges by using selenium as our solver. If the operation is successful, the session cookies are collected so you can access the site just as how you would with `requests` without the 405 and or 500 anymore.\n- Another point to make is that scraping with a full on web browser is pretty CPU intensive, it would make sense to use requests lib for a much lighter operation. The plan here is to run only the browser once to collect the cookies and then use requests library to scrape the website.\n\n**Is this just a requests wrapper?** No, it is simply an extension of `requests` library where it tries to simplify the process of bypassing cloudflare IUAM.\n\nYou can directly access the `requests.Session` object in the `cfSession.session` attribute \n```py\nfrom CFSession import cfSession\n\nsession = cfSession()\nsession.session #\u003c--- A requests.Session object\n```\n\n## Disclaimer:\nThis library was created with the sole purpose of educational purposes only, any rules/laws/ToS broken should only be held at the sole responsibility of the user.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfsession%2Fcfsession","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcfsession%2Fcfsession","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfsession%2Fcfsession/lists"}