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

feat(functions/slack): add GCF v2 decorators #7889

Merged
merged 8 commits into from May 13, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
4 changes: 3 additions & 1 deletion functions/slack/main.py
@@ -1,4 +1,4 @@
# Copyright 2018, Google, LLC.
# Copyright 2022 Google LLC.
ace-n marked this conversation as resolved.
Show resolved Hide resolved
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand All @@ -15,6 +15,7 @@
import os

from flask import jsonify
import functions_framework
import googleapiclient.discovery
from slack.signature import SignatureVerifier

Expand Down Expand Up @@ -89,6 +90,7 @@ def make_search_request(query):


# [START functions_slack_search]
@functions_framework.http
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry I'm not too informed about this decorator, is this for good practice? If this is a recommended approach, and this is going to show up on the Sample Browser as well, I think it might be good to be able to point users towards some sort of documentation that explains why using this might be beneficial!

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it was documented; This PR GoogleCloudPlatform/functions-framework-nodejs#347 is the most detailed bit I could find. Thoughts on whether we should point to it?

def kg_search(request):
if request.method != 'POST':
return 'Only POST requests are accepted', 405
Expand Down
1 change: 1 addition & 0 deletions functions/slack/requirements.txt
@@ -1,3 +1,4 @@
google-api-python-client==2.41.0
flask==2.1.0
functions-framework==3.0.0
slackclient==2.9.4