{"id":13421640,"url":"https://github.com/corydolphin/flask-cors","last_synced_at":"2025-05-12T13:32:21.277Z","repository":{"id":9759231,"uuid":"11726155","full_name":"corydolphin/flask-cors","owner":"corydolphin","description":"Cross Origin Resource Sharing ( CORS ) support for Flask ","archived":false,"fork":false,"pushed_at":"2025-02-24T04:11:10.000Z","size":1127,"stargazers_count":912,"open_issues_count":64,"forks_count":143,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-20T13:07:05.339Z","etag":null,"topics":["cors","flask-cors","flask-extensions","python"],"latest_commit_sha":null,"homepage":"https://flask-cors.readthedocs.io/en/latest/index.html","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/corydolphin.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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":"2013-07-28T21:33:57.000Z","updated_at":"2025-04-17T02:15:20.000Z","dependencies_parsed_at":"2025-02-19T05:02:02.526Z","dependency_job_id":"613a9e7b-e773-4950-9d5a-3753f4f424bb","html_url":"https://github.com/corydolphin/flask-cors","commit_stats":{"total_commits":258,"total_committers":44,"mean_commits":5.863636363636363,"dds":0.4651162790697675,"last_synced_commit":"b2c4da1f909fe60f9f01267ea25dc6ca4e10a071"},"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corydolphin%2Fflask-cors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corydolphin%2Fflask-cors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corydolphin%2Fflask-cors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corydolphin%2Fflask-cors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/corydolphin","download_url":"https://codeload.github.com/corydolphin/flask-cors/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250237830,"owners_count":21397400,"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":["cors","flask-cors","flask-extensions","python"],"created_at":"2024-07-30T23:00:27.535Z","updated_at":"2025-04-23T17:10:37.679Z","avatar_url":"https://github.com/corydolphin.png","language":"Python","readme":"Flask-CORS\n==========\n\n|Build Status| |Latest Version| |Supported Python versions|\n|License|\n\nA Flask extension for handling Cross Origin Resource Sharing (CORS), making cross-origin AJAX possible.\n\nThis package has a simple philosophy: when you want to enable CORS, you wish to enable it for all use cases on a domain.\nThis means no mucking around with different allowed headers, methods, etc.\n\nBy default, submission of cookies across domains is disabled due to the security implications.\nPlease see the documentation for how to enable credential'ed requests, and please make sure you add some sort of `CSRF \u003chttp://en.wikipedia.org/wiki/Cross-site_request_forgery\u003e`__ protection before doing so!\n\nInstallation\n------------\n\nInstall the extension with using pip, or easy\\_install.\n\n.. code:: bash\n\n    $ pip install -U flask-cors\n\nUsage\n-----\n\nThis package exposes a Flask extension which by default enables CORS support on all routes, for all origins and methods.\nIt allows parameterization of all CORS headers on a per-resource level.\nThe package also contains a decorator, for those who prefer this approach.\n\nSimple Usage\n~~~~~~~~~~~~\n\nIn the simplest case, initialize the Flask-Cors extension with default arguments in order to allow CORS for all domains on all routes.\nSee the full list of options in the `documentation \u003chttps://flask-cors.readthedocs.io/en/latest/api.html#extension\u003e`__.\n\n.. code:: python\n\n\n    from flask import Flask\n    from flask_cors import CORS\n\n    app = Flask(__name__)\n    CORS(app)\n\n    @app.route(\"/\")\n    def helloWorld():\n      return \"Hello, cross-origin-world!\"\n\nResource specific CORS\n^^^^^^^^^^^^^^^^^^^^^^\n\nAlternatively, you can specify CORS options on a resource and origin level of granularity by passing a dictionary as the `resources` option, mapping paths to a set of options.\nSee the full list of options in the `documentation \u003chttps://flask-cors.readthedocs.io/en/latest/api.html#extension\u003e`__.\n\n.. code:: python\n\n    app = Flask(__name__)\n    cors = CORS(app, resources={r\"/api/*\": {\"origins\": \"*\"}})\n\n    @app.route(\"/api/v1/users\")\n    def list_users():\n      return \"user example\"\n\nRoute specific CORS via decorator\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThis extension also exposes a simple decorator to decorate flask routes with.\nSimply add ``@cross_origin()`` below a call to Flask's ``@app.route(..)`` to allow CORS on a given route.\nSee the full list of options in the `decorator documentation \u003chttps://flask-cors.readthedocs.io/en/latest/api.html#decorator\u003e`__.\n\n.. code:: python\n\n    @app.route(\"/\")\n    @cross_origin()\n    def helloWorld():\n      return \"Hello, cross-origin-world!\"\n\nDocumentation\n-------------\n\nFor a full list of options, please see the full `documentation \u003chttps://flask-cors.readthedocs.io/en/latest/api.html\u003e`__\n\nTroubleshooting\n---------------\n\nIf things aren't working as you expect, enable logging to help understand what is going on under the hood, and why.\n\n.. code:: python\n\n    logging.getLogger('flask_cors').level = logging.DEBUG\n\n\n\nSet Up Your Development Environment\n---\nThe development environment uses `uv` for Python version management as well as dependency management.\nThere are helpful Makefile targets to do everything you need. Use `make test` to get started!\n\n\nContributing\n------------\n\nQuestions, comments or improvements?\nPlease create an issue on `Github \u003chttps://github.com/corydolphin/flask-cors\u003e`__, tweet at `@corydolphin \u003chttps://twitter.com/corydolphin\u003e`__ or send me an email.\nI do my best to include every contribution proposed in any way that I can.\n\nCredits\n-------\n\nThis Flask extension is based upon the `Decorator for the HTTP Access Control \u003chttps://web.archive.org/web/20190128010149/http://flask.pocoo.org/snippets/56/\u003e`__ written by Armin Ronacher.\n\n.. |Build Status| image:: https://github.com/corydolphin/flask-cors/actions/workflows/unittests.yaml/badge.svg\n   :target: https://travis-ci.org/corydolphin/flask-cors\n.. |Latest Version| image:: https://img.shields.io/pypi/v/Flask-Cors.svg\n   :target: https://pypi.python.org/pypi/Flask-Cors/\n.. |Supported Python versions| image:: https://img.shields.io/pypi/pyversions/Flask-Cors.svg\n   :target: https://img.shields.io/pypi/pyversions/Flask-Cors.svg\n.. |License| image:: http://img.shields.io/:license-mit-blue.svg\n   :target: https://pypi.python.org/pypi/Flask-Cors/\n","funding_links":[],"categories":["Python","Flask Utilities","介绍","Frontend"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorydolphin%2Fflask-cors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcorydolphin%2Fflask-cors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorydolphin%2Fflask-cors/lists"}