Skip to content

Commit

Permalink
feat: add "subscription-key" as query parameter, to support Azure and…
Browse files Browse the repository at this point in the history
… other APIs that wish to use API keys.
  • Loading branch information
recalcitrantsupplant committed Nov 10, 2024
1 parent 45ad323 commit c7c7522
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions prez/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ async def check_unknown_params(request: Request):
"filter",
"order_by",
"order_by_direction",
"subscription-key",
}
unknown_params = set(request.query_params.keys()) - known_params
if unknown_params:
Expand Down
6 changes: 6 additions & 0 deletions prez/models/query_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ def __init__(
default=None,
description="Optional: Order direction, must be 'ASC' or 'DESC'",
),
subscription_key: str = Query(
default=None,
description="An optional API Subscription key",
alias="subscription-key",
),
):
self.q = q
self.page = page
Expand All @@ -172,6 +177,7 @@ def __init__(
self.order_by_direction = order_by_direction
self.filter = filter
self.mediatype = mediatype
self.subscription_key = subscription_key
self.validate_filter()

def validate_filter(self):
Expand Down

0 comments on commit c7c7522

Please sign in to comment.