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

Features/versioning and flags #375

Merged
merged 8 commits into from
Oct 23, 2024
Merged

Features/versioning and flags #375

merged 8 commits into from
Oct 23, 2024

Conversation

caparker
Copy link
Collaborator

@caparker caparker commented Oct 3, 2024

Updates required for CAC work

requests_used = value

response.headers["x-ratelimit-limit"] = str(limit)
response.headers["x-ratelimit-remaining"] = "0"
Copy link
Member

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

return False


async def check_api_key(
Copy link
Member

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@@ -21,6 +25,118 @@

logger = logging.getLogger("middleware")

NOT_AUTHENTICATED_EXCEPTION = HTTPException(
Copy link
Member

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added exceptions file

openaq_api/openaq_api/middleware.py Outdated Show resolved Hide resolved
@caparker caparker marked this pull request as ready for review October 23, 2024 15:45
@caparker caparker merged commit e058861 into main Oct 23, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants