Skip to content

Commit 172e339

Browse files
committed
nit.
1 parent e96742c commit 172e339

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Function dependencies
2-
functions-framework
1+
functions-framework>=3.9.2,<4.0.0
32

43
# For testing
5-
httpx
4+
httpx<=0.28.1

examples/cloud_run_async/send_cloud_event.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
from cloudevents.http import CloudEvent, to_structured
2020

21+
2122
async def main():
22-
# Create a cloudevent
2323
attributes = {
2424
"Content-Type": "application/json",
2525
"source": "from-galaxy-far-far-away",
@@ -29,11 +29,10 @@ async def main():
2929

3030
event = CloudEvent(attributes, data)
3131

32-
# Send the event to the local functions-framework server
3332
headers, data = to_structured(event)
34-
33+
3534
async with httpx.AsyncClient() as client:
3635
await client.post("http://localhost:8080/", headers=headers, data=data)
3736

3837
if __name__ == "__main__":
39-
asyncio.run(main())
38+
asyncio.run(main())

examples/cloud_run_streaming_http/README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,49 @@
33
This sample shows how to deploy streaming functions to [Cloud Run](http://cloud.google.com/run) with the Functions Framework. The `main.py` file contains examples for both synchronous and asynchronous streaming.
44

55
## Dependencies
6+
67
Install the dependencies for this example:
8+
79
```sh
810
pip install -r requirements.txt
911
```
1012

1113
## Running locally
1214

1315
### Synchronous Streaming
16+
1417
To run the synchronous streaming function locally:
18+
1519
```sh
1620
functions-framework --target=hello_stream
1721
```
22+
1823
Then, send a request to it from another terminal:
24+
1925
```sh
2026
curl localhost:8080
2127
```
2228

2329
### Asynchronous Streaming
30+
2431
To run the asynchronous streaming function locally:
32+
2533
```sh
2634
functions-framework --target=hello_stream_async
2735
```
36+
2837
Then, send a request to it from another terminal:
38+
2939
```sh
3040
curl localhost:8080
3141
```
3242

3343
## Deploying to Cloud Run
44+
3445
You can deploy these functions to Cloud Run using the `gcloud` CLI.
3546

3647
### Synchronous Streaming
48+
3749
```sh
3850
gcloud run deploy streaming-function \
3951
--source . \
@@ -43,6 +55,7 @@ gcloud run deploy streaming-function \
4355
```
4456

4557
### Asynchronous Streaming
58+
4659
```sh
4760
gcloud run deploy streaming-async-function \
4861
--source . \
@@ -51,4 +64,5 @@ gcloud run deploy streaming-async-function \
5164
--region <YOUR_REGION>
5265
```
5366

54-
```
67+
```
68+
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
# Function dependencies
2-
functions-framework>=3.9.2
1+
functions-framework>=3.9.2,<4.0.0

0 commit comments

Comments
 (0)