-
Notifications
You must be signed in to change notification settings - Fork 508
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 390-support-envelope-in-swagger
- Loading branch information
Showing
41 changed files
with
735 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
name: Bug Report | ||
about: Tell us how Flask-RESTPlus is broken | ||
title: '' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
### ***** **BEFORE LOGGING AN ISSUE** ***** | ||
|
||
- Is this something you can **debug and fix**? Send a pull request! Bug fixes and documentation fixes are welcome. | ||
- Please check if a similar issue already exists or has been closed before. Seriously, nobody here is getting paid. Help us out and take five minutes to make sure you aren't submitting a duplicate. | ||
- Please review the [guidelines for contributing](https://github.com/noirbizarre/flask-restplus/blob/master/CONTRIBUTING.rst) | ||
|
||
### **Code** | ||
|
||
```python | ||
from your_code import your_buggy_implementation | ||
``` | ||
|
||
### **Repro Steps** (if applicable) | ||
1. ... | ||
2. ... | ||
3. Broken! | ||
|
||
### **Expected Behavior** | ||
A description of what you expected to happen. | ||
|
||
### **Actual Behavior** | ||
A description of the unexpected, buggy behavior. | ||
|
||
### **Error Messages/Stack Trace** | ||
If applicable, add the stack trace produced by the error | ||
|
||
### **Environment** | ||
- Python version | ||
- Flask version | ||
- Flask-RESTPlus version | ||
- Other installed Flask extensions | ||
|
||
### **Additional Context** | ||
|
||
This is your last chance to provide any pertinent details, don't let this opportunity pass you by! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## Proposed changes | ||
|
||
At a high level, describe your reasoning for making these changes. If you are fixing a bug or resolving a feature request, **please include a link to the issue**. | ||
|
||
## Types of changes | ||
|
||
What types of changes does your code introduce? | ||
_Put an `x` in the boxes that apply_ | ||
|
||
- [ ] Bugfix (non-breaking change which fixes an issue) | ||
- [ ] New feature (non-breaking change which adds functionality) | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
|
||
## Checklist | ||
|
||
_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._ | ||
|
||
- [ ] I have read the [guidelines for contributing](https://github.com/noirbizarre/flask-restplus/blob/master/CONTRIBUTING.rst) | ||
- [ ] All unit tests pass on my local version with my changes | ||
- [ ] I have added tests that prove my fix is effective or that my feature works | ||
- [ ] I have added necessary documentation (if appropriate) | ||
|
||
## Further comments | ||
|
||
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,29 @@ | ||
language: python | ||
|
||
python: | ||
- 2.7 | ||
- 3.4 | ||
- 3.5 | ||
- 3.6 | ||
- 3.7 | ||
- pypy | ||
- pypy3 | ||
|
||
matrix: | ||
include: | ||
- python: 3.8-dev | ||
dist: xenial | ||
allow_failures: | ||
- python: pypy3 | ||
- python: 3.8-dev | ||
|
||
install: | ||
- pip install .[dev] | ||
|
||
script: | ||
- inv cover qa | ||
|
||
after_success: | ||
- pip install coveralls | ||
- coveralls --rcfile=coverage.rc | ||
- ./travis-bench-after-success.sh | ||
matrix: | ||
allow_failures: | ||
- python: pypy3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ Flask-RESTPlus with Flask. | |
errors | ||
mask | ||
swagger | ||
logging | ||
postman | ||
scaling | ||
example | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
Logging | ||
=============== | ||
|
||
Flask-RESTPlus extends `Flask's logging <https://flask.palletsprojects.com/en/1.1.x/logging/>`_ | ||
by providing each ``API`` and ``Namespace`` it's own standard Python :class:`logging.Logger` instance. | ||
This allows separation of logging on a per namespace basis to allow more fine-grained detail and configuration. | ||
|
||
By default, these loggers inherit configuration from the Flask application object logger. | ||
|
||
.. code-block:: python | ||
import logging | ||
import flask | ||
from flask_restplus import Api, Resource | ||
# configure root logger | ||
logging.basicConfig(level=logging.INFO) | ||
app = flask.Flask(__name__) | ||
api = Api(app) | ||
# each of these loggers uses configuration from app.logger | ||
ns1 = api.namespace('api/v1', description='test') | ||
ns2 = api.namespace('api/v2', description='test') | ||
@ns1.route('/my-resource') | ||
class MyResource(Resource): | ||
def get(self): | ||
# will log | ||
ns1.logger.info("hello from ns1") | ||
return {"message": "hello"} | ||
@ns2.route('/my-resource') | ||
class MyNewResource(Resource): | ||
def get(self): | ||
# won't log due to INFO log level from app.logger | ||
ns2.logger.debug("hello from ns2") | ||
return {"message": "hello"} | ||
Loggers can be configured individually to override the configuration from the Flask | ||
application object logger. In the above example, ``ns2`` log level can be set to | ||
``DEBUG`` individually: | ||
|
||
.. code-block:: python | ||
# ns1 will have log level INFO from app.logger | ||
ns1 = api.namespace('api/v1', description='test') | ||
# ns2 will have log level DEBUG | ||
ns2 = api.namespace('api/v2', description='test') | ||
ns2.logger.setLevel(logging.DEBUG) | ||
@ns1.route('/my-resource') | ||
class MyResource(Resource): | ||
def get(self): | ||
# will log | ||
ns1.logger.info("hello from ns1") | ||
return {"message": "hello"} | ||
@ns2.route('/my-resource') | ||
class MyNewResource(Resource): | ||
def get(self): | ||
# will log | ||
ns2.logger.debug("hello from ns2") | ||
return {"message": "hello"} | ||
Adding additional handlers: | ||
|
||
|
||
.. code-block:: python | ||
# configure a file handler for ns1 only | ||
ns1 = api.namespace('api/v1') | ||
fh = logging.FileHandler("v1.log") | ||
ns1.logger.addHandler(fh) | ||
ns2 = api.namespace('api/v2') | ||
@ns1.route('/my-resource') | ||
class MyResource(Resource): | ||
def get(self): | ||
# will log to *both* v1.log file and app.logger handlers | ||
ns1.logger.info("hello from ns1") | ||
return {"message": "hello"} | ||
@ns2.route('/my-resource') | ||
class MyNewResource(Resource): | ||
def get(self): | ||
# will log to *only* app.logger handlers | ||
ns2.logger.info("hello from ns2") | ||
return {"message": "hello"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.