You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -16,19 +15,24 @@ This library contains HttpV2 extensions for FastApi Request/Response types to us
16
15
17
16
### Instructions
18
17
1. Follow the guide to [create an app](https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-python?tabs=windows%2Cbash%2Cazure-cli%2Cbrowser). If you're testing the function locally, make sure to update to the latest version of Core Tools.
19
-
2. Ensure your app is using programming model v2 and contains a http trigger function.
18
+
2. Ensure your app is using programming model v2 and contains an HttpTrigger function.
20
19
3. Add ```azurefunctions-extensions-http-fastapi``` to your requirements.txt
21
20
4. Import Request and different types of responses from ```azurefunctions.extensions.http.fastapi``` in your HttpTrigger functions.
22
21
5. Change the request and response types to ones imported from ```azurefunctions.extensions.http.fastapi```.
23
22
6. Add ```"PYTHON_ENABLE_INIT_INDEXING": "1"``` to your local.settings.json file or App Settings.
24
-
6. Run your function app and try it out!
23
+
7. Run your function app and try it out!
25
24
26
-
### Bind to the FastApi-type
27
-
The Azure Functions Extensions Http FastApi library for Python allows you to create a function app with FastApi Request or Response types. When your function runs, you will receive the request of FastApi Request type and you can return a FastApi response type instance. FastApi is one of top popular python web framework which provides elegant and powerful request/response types and functionalities to users. With this integration, you are empowered to use request/response the same way as using them in native FastApi. A good example is you can do http streaming upload and streaming download now! Feel free to check out [Fastapi doc](https://fastapi.tiangolo.com/reference/responses/?h=custom) for further reference.
25
+
### Bind to the FastApi type
26
+
The Azure Functions Extensions HTTP FastApi library for Python allows you to create a function app with FastApi Request or Response types.
27
+
When your function runs, you will receive the FastApi Request type, and you can return a FastApi Response type.
28
+
29
+
FastApi is one of the top Python web frameworks that provides elegant and powerful Request/Response types and functionalities.
30
+
With this integration, you are empowered to use Request/Response types the same way as with native FastApi. For example, HTTP streaming
31
+
upload and download scenarios are now possible! Please reference the [FastApi documentation](https://fastapi.tiangolo.com/reference/responses/?h=custom) for further information.
28
32
29
33
30
34
```python
31
-
# This Azure Function receives streaming data from a client and processes it in real-time.
35
+
# This function app receives streaming data from a client and processes it in real-time.
32
36
# It demonstrates streaming upload capabilities for scenarios such as uploading large files,
33
37
# processing continuous data streams, or handling IoT device data.
34
38
@@ -61,9 +65,9 @@ Get started with our [FastApi samples](https://github.com/Azure/azure-functions-
61
65
62
66
Several samples are available in this GitHub repository. These samples provide example code for additional scenarios commonly encountered while working with FastApi:
63
67
64
-
*[fastapi_samples_streaming_upload](https://github.com/Azure/azure-functions-python-extensions/tree/dev/azurefunctions-extensions-http-fastapi/samples/fastapi_samples_streaming_upload) - An example on how to send and receiving a streaming request within your function.
68
+
*[fastapi_samples_streaming_upload](https://github.com/Azure/azure-functions-python-extensions/tree/dev/azurefunctions-extensions-http-fastapi/samples/fastapi_samples_streaming_upload) - An example on how to send and receive a streaming request within your function.
65
69
66
-
*[fastapi_samples_streaming_download](https://github.com/Azure/azure-functions-python-extensions/tree/dev/azurefunctions-extensions-http-fastapi/samples/fastapi_samples_streaming_download) - An example on how to send your http response via streaming to the caller.
70
+
*[fastapi_samples_streaming_download](https://github.com/Azure/azure-functions-python-extensions/tree/dev/azurefunctions-extensions-http-fastapi/samples/fastapi_samples_streaming_download) - An example on how to send your HTTP response via streaming to the caller.
67
71
68
72
## Contributing
69
73
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
# Azure Functions Extension FastAPI library for Python samples
14
+
15
+
These are code samples that show common scenario operations with the Azure Functions Extension FastAPI library.
16
+
17
+
These samples relate to FastApi Request and Response types being used as part of a Python Function App. For
18
+
information on FastAPI, please see the [FastApi documentation](https://fastapi.tiangolo.com/reference/responses/?h=custom).
19
+
20
+
*[fastapi_samples_streaming_upload](https://github.com/Azure/azure-functions-python-extensions/tree/dev/azurefunctions-extensions-http-fastapi/samples/fastapi_samples_streaming_upload) - An example on how to send and receive a streaming request within your function.
21
+
22
+
*[fastapi_samples_streaming_download](https://github.com/Azure/azure-functions-python-extensions/tree/dev/azurefunctions-extensions-http-fastapi/samples/fastapi_samples_streaming_download) - An example on how to send your HTTP response via streaming to the caller.
23
+
24
+
## Prerequisites
25
+
* Python 3.8 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages).
4. Open the sample folder in Visual Studio Code or your IDE of choice.
38
+
39
+
## Running the samples
40
+
41
+
1. Open a terminal window and `cd` to the directory that the sample you wish to run is saved in.
42
+
2. Install the required dependencies
43
+
```bash
44
+
pip install -r requirements.txt
45
+
```
46
+
3. Start the Functions runtime
47
+
```bash
48
+
func start
49
+
```
50
+
4. Execute the function by sending an HTTP request to the local endpoint.
51
+
52
+
## Next steps
53
+
54
+
Visit the [HTTP Streams in Python reference documentation](https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-python?tabs=get-started%2Casgi%2Capplication-level&pivots=python-mode-decorators#http-streams-preview) to learn more about how to use HTTP Streams in a Python Function App and the
55
+
[FastApi documentation](https://fastapi.tiangolo.com/reference/responses/?h=custom) to learn more about
0 commit comments