Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zoom-python-webhook
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Samuel Guillemet
zoom-python-webhook
Commits
99976484
Unverified
Commit
99976484
authored
1 year ago
by
Samuel Guillemet
Browse files
Options
Downloads
Patches
Plain Diff
IMPROVE: Use load_modules to load endpoints
parent
9b0a2a91
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!16
🚀 RELEASE: Bump to 0.2.1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/app/api/v1/api.py
+2
-6
2 additions, 6 deletions
src/app/api/v1/api.py
src/app/api/v1/endpoints/__init__.py
+0
-3
0 additions, 3 deletions
src/app/api/v1/endpoints/__init__.py
src/app/api/v1/endpoints/webhook.py
+7
-7
7 additions, 7 deletions
src/app/api/v1/endpoints/webhook.py
with
9 additions
and
16 deletions
src/app/api/v1/api.py
+
2
−
6
View file @
99976484
"""
API v1 router.
"""
import
importlib
from
fastapi
import
APIRouter
from
app.api.v1
import
endpoints
from
app.utils.load_submodules
import
load_submodules
endpoints_module
=
[
importlib
.
import_module
(
f
"
app.api.v1.endpoints.
{
module
}
"
)
for
module
in
endpoints
.
__all__
]
endpoints_module
=
load_submodules
(
endpoints
)
api_v1_router
=
APIRouter
()
...
...
This diff is collapsed.
Click to expand it.
src/app/api/v1/endpoints/__init__.py
+
0
−
3
View file @
99976484
from
.
import
webhook
__all__
=
[
"
webhook
"
]
This diff is collapsed.
Click to expand it.
src/app/api/v1/endpoints/webhook.py
+
7
−
7
View file @
99976484
...
...
@@ -18,12 +18,6 @@ logger = logging.getLogger("app.api.v1.webhook")
router
=
APIRouter
(
tags
=
[
"
webhook
"
],
prefix
=
"
/webhook
"
)
# Common responses for the error cases.
responses
=
{
403
:
{
"
description
"
:
"
Webhook signature verification failed.
"
,
"
model
"
:
ErrorModel
},
501
:
{
"
description
"
:
"
Webhook event not supported.
"
,
"
model
"
:
ErrorModel
},
}
# Load all webhook components and create a list of tuples containing
# the event name, handler function, and response model.
components_tuple
:
list
[
...
...
@@ -44,7 +38,13 @@ components_tuple: list[
response_model
=
Union
[
tuple
(
response_model
for
_
,
_
,
response_model
in
components_tuple
)
# type: ignore
],
responses
=
{
**
responses
},
responses
=
{
403
:
{
"
description
"
:
"
Webhook signature verification failed.
"
,
"
model
"
:
ErrorModel
,
},
501
:
{
"
description
"
:
"
Webhook event not supported.
"
,
"
model
"
:
ErrorModel
},
},
)
async
def
webhook_route
(
webhook_event
:
BaseWebhookEvent
):
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment