-
Notifications
You must be signed in to change notification settings - Fork 120
Expand file tree
/
Copy pathtest_typing.py
More file actions
28 lines (19 loc) · 875 Bytes
/
test_typing.py
File metadata and controls
28 lines (19 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import typing
if typing.TYPE_CHECKING: # pragma: no cover
import flask
from cloudevents.http.event import CloudEvent
import functions_framework
@functions_framework.http
def hello(request: flask.Request) -> flask.typing.ResponseReturnValue:
return "Hello world!"
@functions_framework.cloud_event
def hello_cloud_event(cloud_event: CloudEvent) -> None:
print(f"Received event: id={cloud_event['id']} and data={cloud_event.data}")
from starlette.requests import Request
import functions_framework.aio
@functions_framework.aio.http
async def hello_async(request: Request) -> str:
return "Hello world!"
@functions_framework.aio.cloud_event
async def hello_cloud_event_async(cloud_event: CloudEvent) -> None:
print(f"Received event: id={cloud_event['id']} and data={cloud_event.data}")