-
Notifications
You must be signed in to change notification settings - Fork 10
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
Features/versioning and flags #375
Conversation
openaq_api/openaq_api/middleware.py
Outdated
requests_used = value | ||
|
||
response.headers["x-ratelimit-limit"] = str(limit) | ||
response.headers["x-ratelimit-remaining"] = "0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldnt be hardcoded to "0", needs to be dynamic showing the remaining number of requests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
openaq_api/openaq_api/middleware.py
Outdated
return False | ||
|
||
|
||
async def check_api_key( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although this is acting like middleware still, We should move it to a new file called dependencies? I would like the middleware to all be ASGI middleware which this no longer is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
openaq_api/openaq_api/middleware.py
Outdated
@@ -21,6 +25,118 @@ | |||
|
|||
logger = logging.getLogger("middleware") | |||
|
|||
NOT_AUTHENTICATED_EXCEPTION = HTTPException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets put these in either the v3/models/responses.py or a separate exceptions.py file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added exceptions file
Updates required for CAC work