Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Added error handler for status 429 #6678

Merged
merged 29 commits into from Jan 13, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7e824fe
Added Error handler for status 429
Rits1272 Dec 19, 2019
dfcad5b
Revert "feat: Optimize marshamllow jsonapi link generation (#6656)" (…
kushthedude Dec 21, 2019
f6bd4b1
Revert "Revert "feat: Optimize marshamllow jsonapi link generation (#…
iamareebjamal Dec 21, 2019
f5c7235
fix: Order Post route view (#6683)
prateekj117 Dec 21, 2019
a00d19c
chore(deps): update geoip2 requirement from ~=2.9.0 to ~=3.0.0 (#6681)
dependabot-preview[bot] Dec 21, 2019
b6f948b
chore(deps): update celery requirement from ~=4.3 to ~=4.4 (#6670)
dependabot-preview[bot] Dec 21, 2019
d104ea2
chore(deps): update sqlalchemy requirement from ~=1.3.11 to ~=1… (#6671)
dependabot-preview[bot] Dec 21, 2019
09614e9
chore(deps): update coverage requirement from ~=4.5 to ~=5.0 (#6672)
dependabot-preview[bot] Dec 21, 2019
2305a56
Added error handler for status 429
Rits1272 Dec 22, 2019
849040a
Merge branch 'development' into development
Rits1272 Dec 22, 2019
5c65efc
Added error handler for status 429
Rits1272 Dec 22, 2019
9937e99
Merge branch 'development' of https://github.com/Rits1272/open-event-…
Rits1272 Dec 22, 2019
73b2b98
Added error handler for status 429
Rits1272 Dec 22, 2019
d71b9c5
Added error handler for status 429
Rits1272 Dec 22, 2019
f21a822
Merge branch 'development' into development
Rits1272 Dec 22, 2019
569a696
Merge branch 'master' of https://github.com/fossasia/open-event-serve…
Rits1272 Dec 23, 2019
9063705
Merge branch 'development' into development
Rits1272 Dec 23, 2019
9ef2e0d
Added error handler for status 429
Rits1272 Dec 23, 2019
cf80899
Merge branch 'development' of https://github.com/Rits1272/open-event-…
Rits1272 Dec 23, 2019
d0419ef
Added error handler for status 429
Rits1272 Dec 23, 2019
0c65e38
Merge branch 'development' of https://github.com/fossasia/open-event-…
Rits1272 Jan 3, 2020
4ca8411
Added error handler for status 429
Rits1272 Jan 3, 2020
3403d03
Merge branch 'development' into development
Rits1272 Jan 4, 2020
a6b749d
Merge branch 'development' into development
Rits1272 Jan 6, 2020
1584492
Merge branch 'development' into development
Rits1272 Jan 9, 2020
ffd433d
Added 429 error handler
Rits1272 Jan 9, 2020
9fb7911
Merge branch 'development' of https://github.com/Rits1272/open-event-…
Rits1272 Jan 9, 2020
2a1ec01
Added error handler for status 429
Rits1272 Jan 10, 2020
9c60849
Added error handler for status 429
Rits1272 Jan 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions app/__init__.py
Expand Up @@ -290,11 +290,10 @@ def internal_server_error(error):


@app.errorhandler(429)
def ratelimit_handler(err):
return make_response(
jsonify(error="ratelimit exceeded %s" % err.description)
, 429
)
def ratelimit_handler(error):
exc = JsonApiException({'pointer': ''}, str(error))
return make_response(json.dumps(jsonapi_errors([exc.to_dict()])), exc.status,
{'Content-Type': 'application/vnd.api+json'})
Rits1272 marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not what we want. Did you even test what it returns?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, Working on it @iamareebjamal.



if __name__ == '__main__':
Expand Down
1 change: 1 addition & 0 deletions app/api/helpers/errors.py
Expand Up @@ -15,6 +15,7 @@ class ErrorResponse:

def __init__(self, source, detail, title=None, status=None):
"""Initialize a jsonapi ErrorResponse Object

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

:param dict source: the source of the error
:param str detail: the detail of the error
"""
Expand Down