flask-cors 0.0.0.dev3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+ Metadata-Version: 2.2
2
+ Name: flask-cors
3
+ Version: 0.0.0.dev3
4
+ Summary: A Flask extension simplifying CORS support
5
+ Author-email: Cory Dolphin <corydolphin@gmail.com>
6
+ Project-URL: Homepage, https://corydolphin.github.io/flask-cors/
7
+ Project-URL: Repository, https://github.com/corydolphin/flask-cors
8
+ Project-URL: Documentation, https://corydolphin.github.io/flask-cors/
9
+ Keywords: python
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Requires-Python: <4.0,>=3.9
20
+ Description-Content-Type: text/markdown
21
+ Requires-Dist: flask>=0.9
22
+ Requires-Dist: Werkzeug>=0.7
@@ -0,0 +1,120 @@
1
+ Flask-CORS
2
+ ==========
3
+
4
+ |Build Status| |Latest Version| |Supported Python versions|
5
+ |License|
6
+
7
+ A Flask extension for handling Cross Origin Resource Sharing (CORS), making cross-origin AJAX possible.
8
+
9
+ This package has a simple philosophy: when you want to enable CORS, you wish to enable it for all use cases on a domain.
10
+ This means no mucking around with different allowed headers, methods, etc.
11
+
12
+ By default, submission of cookies across domains is disabled due to the security implications.
13
+ Please see the documentation for how to enable credential'ed requests, and please make sure you add some sort of `CSRF <http://en.wikipedia.org/wiki/Cross-site_request_forgery>`__ protection before doing so!
14
+
15
+ Installation
16
+ ------------
17
+
18
+ Install the extension with using pip, or easy\_install.
19
+
20
+ .. code:: bash
21
+
22
+ $ pip install -U flask-cors
23
+
24
+ Usage
25
+ -----
26
+
27
+ This package exposes a Flask extension which by default enables CORS support on all routes, for all origins and methods.
28
+ It allows parameterization of all CORS headers on a per-resource level.
29
+ The package also contains a decorator, for those who prefer this approach.
30
+
31
+ Simple Usage
32
+ ~~~~~~~~~~~~
33
+
34
+ In the simplest case, initialize the Flask-Cors extension with default arguments in order to allow CORS for all domains on all routes.
35
+ See the full list of options in the `documentation <https://flask-cors.readthedocs.io/en/latest/api.html#extension>`__.
36
+
37
+ .. code:: python
38
+
39
+
40
+ from flask import Flask
41
+ from flask_cors import CORS
42
+
43
+ app = Flask(__name__)
44
+ CORS(app)
45
+
46
+ @app.route("/")
47
+ def helloWorld():
48
+ return "Hello, cross-origin-world!"
49
+
50
+ Resource specific CORS
51
+ ^^^^^^^^^^^^^^^^^^^^^^
52
+
53
+ Alternatively, 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.
54
+ See the full list of options in the `documentation <https://flask-cors.readthedocs.io/en/latest/api.html#extension>`__.
55
+
56
+ .. code:: python
57
+
58
+ app = Flask(__name__)
59
+ cors = CORS(app, resources={r"/api/*": {"origins": "*"}})
60
+
61
+ @app.route("/api/v1/users")
62
+ def list_users():
63
+ return "user example"
64
+
65
+ Route specific CORS via decorator
66
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
67
+
68
+ This extension also exposes a simple decorator to decorate flask routes with.
69
+ Simply add ``@cross_origin()`` below a call to Flask's ``@app.route(..)`` to allow CORS on a given route.
70
+ See the full list of options in the `decorator documentation <https://flask-cors.readthedocs.io/en/latest/api.html#decorator>`__.
71
+
72
+ .. code:: python
73
+
74
+ @app.route("/")
75
+ @cross_origin()
76
+ def helloWorld():
77
+ return "Hello, cross-origin-world!"
78
+
79
+ Documentation
80
+ -------------
81
+
82
+ For a full list of options, please see the full `documentation <https://flask-cors.readthedocs.io/en/latest/api.html>`__
83
+
84
+ Troubleshooting
85
+ ---------------
86
+
87
+ If things aren't working as you expect, enable logging to help understand what is going on under the hood, and why.
88
+
89
+ .. code:: python
90
+
91
+ logging.getLogger('flask_cors').level = logging.DEBUG
92
+
93
+
94
+
95
+ Set Up Your Development Environment
96
+ ---
97
+ The development environment uses `uv` for Python version management as well as dependency management.
98
+ There are helpful Makefile targets to do everything you need. Use `make test` to get started!
99
+
100
+
101
+ Contributing
102
+ ------------
103
+
104
+ Questions, comments or improvements?
105
+ Please create an issue on `Github <https://github.com/corydolphin/flask-cors>`__, tweet at `@corydolphin <https://twitter.com/corydolphin>`__ or send me an email.
106
+ I do my best to include every contribution proposed in any way that I can.
107
+
108
+ Credits
109
+ -------
110
+
111
+ This Flask extension is based upon the `Decorator for the HTTP Access Control <https://web.archive.org/web/20190128010149/http://flask.pocoo.org/snippets/56/>`__ written by Armin Ronacher.
112
+
113
+ .. |Build Status| image:: https://github.com/corydolphin/flask-cors/actions/workflows/unittests.yaml/badge.svg
114
+ :target: https://travis-ci.org/corydolphin/flask-cors
115
+ .. |Latest Version| image:: https://img.shields.io/pypi/v/Flask-Cors.svg
116
+ :target: https://pypi.python.org/pypi/Flask-Cors/
117
+ .. |Supported Python versions| image:: https://img.shields.io/pypi/pyversions/Flask-Cors.svg
118
+ :target: https://img.shields.io/pypi/pyversions/Flask-Cors.svg
119
+ .. |License| image:: http://img.shields.io/:license-mit-blue.svg
120
+ :target: https://pypi.python.org/pypi/Flask-Cors/
@@ -0,0 +1,22 @@
1
+ Metadata-Version: 2.2
2
+ Name: flask-cors
3
+ Version: 0.0.0.dev3
4
+ Summary: A Flask extension simplifying CORS support
5
+ Author-email: Cory Dolphin <corydolphin@gmail.com>
6
+ Project-URL: Homepage, https://corydolphin.github.io/flask-cors/
7
+ Project-URL: Repository, https://github.com/corydolphin/flask-cors
8
+ Project-URL: Documentation, https://corydolphin.github.io/flask-cors/
9
+ Keywords: python
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Requires-Python: <4.0,>=3.9
20
+ Description-Content-Type: text/markdown
21
+ Requires-Dist: flask>=0.9
22
+ Requires-Dist: Werkzeug>=0.7
@@ -0,0 +1,7 @@
1
+ README.rst
2
+ pyproject.toml
3
+ flask_cors.egg-info/PKG-INFO
4
+ flask_cors.egg-info/SOURCES.txt
5
+ flask_cors.egg-info/dependency_links.txt
6
+ flask_cors.egg-info/requires.txt
7
+ flask_cors.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ flask>=0.9
2
+ Werkzeug>=0.7
@@ -0,0 +1 @@
1
+ flask_cors
@@ -0,0 +1,112 @@
1
+ [project]
2
+ name = "flask-cors"
3
+ version = "0.0.0dev3"
4
+ description = "A Flask extension simplifying CORS support"
5
+ authors = [{ name = "Cory Dolphin", email = "corydolphin@gmail.com" }]
6
+ readme = "README.md"
7
+ keywords = ['python']
8
+ requires-python = ">=3.9,<4.0"
9
+ classifiers = [
10
+ "Intended Audience :: Developers",
11
+ "Programming Language :: Python",
12
+ "Programming Language :: Python :: 3",
13
+ "Programming Language :: Python :: 3.9",
14
+ "Programming Language :: Python :: 3.10",
15
+ "Programming Language :: Python :: 3.11",
16
+ "Programming Language :: Python :: 3.12",
17
+ "Programming Language :: Python :: 3.13",
18
+ "Topic :: Software Development :: Libraries :: Python Modules",
19
+ ]
20
+ dependencies = [
21
+ "flask>=0.9",
22
+ "Werkzeug>=0.7"
23
+ ]
24
+
25
+ [project.urls]
26
+ Homepage = "https://corydolphin.github.io/flask-cors/"
27
+ Repository = "https://github.com/corydolphin/flask-cors"
28
+ Documentation = "https://corydolphin.github.io/flask-cors/"
29
+
30
+ [dependency-groups]
31
+ dev = [
32
+ "pytest>=7.2.0",
33
+ "pre-commit>=2.20.0",
34
+ "tox-uv>=1.11.3",
35
+ "deptry>=0.22.0",
36
+ "mypy>=0.991",
37
+ "pytest-cov>=4.0.0",
38
+ "ruff>=0.9.2",
39
+ "mkdocs>=1.4.2",
40
+ "mkdocs-material>=8.5.10",
41
+ "mkdocstrings[python]>=0.26.1",
42
+ ]
43
+
44
+ [build-system]
45
+ requires = ["setuptools"]
46
+ build-backend = "setuptools.build_meta"
47
+
48
+ [tool.setuptools]
49
+ py-modules = ["flask_cors"]
50
+ # This is a workaround for https://github.com/astral-sh/uv/issues/9513
51
+ license-files = []
52
+
53
+ [tool.pytest.ini_options]
54
+ testpaths = ["tests"]
55
+
56
+ [tool.ruff]
57
+ target-version = "py39"
58
+ line-length = 120
59
+ fix = true
60
+
61
+ [tool.ruff.lint]
62
+ select = [
63
+ # flake8-2020
64
+ "YTT",
65
+ # flake8-bandit
66
+ "S",
67
+ # flake8-bugbear
68
+ "B",
69
+ # flake8-builtins
70
+ "A",
71
+ # flake8-comprehensions
72
+ "C4",
73
+ # flake8-debugger
74
+ "T10",
75
+ # flake8-simplify
76
+ "SIM",
77
+ # isort
78
+ "I",
79
+ # mccabe
80
+ "C90",
81
+ # pycodestyle
82
+ "E", "W",
83
+ # pyflakes
84
+ "F",
85
+ # pygrep-hooks
86
+ "PGH",
87
+ # pyupgrade
88
+ "UP",
89
+ # ruff
90
+ "RUF",
91
+ # tryceratops
92
+ "TRY",
93
+ ]
94
+ ignore = [
95
+ # LineTooLong
96
+ "E501",
97
+ # DoNotAssignLambda
98
+ "E731",
99
+ ]
100
+
101
+ [tool.ruff.lint.per-file-ignores]
102
+ "tests/*" = ["S101"]
103
+
104
+ [tool.ruff.format]
105
+ preview = true
106
+
107
+ [tool.coverage.report]
108
+ skip_empty = true
109
+
110
+ [tool.coverage.run]
111
+ branch = true
112
+ source = ["flask_cors"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+