Skip to content

Commit 720866a

Browse files
Copilotnzthiago
andcommitted
Update README.md to reflect latest test.http format and function implementation
Co-authored-by: nzthiago <[email protected]>
1 parent 68940d2 commit 720866a

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,33 @@ Create two containers in the local storage emulator called `processed-pdf` and `
147147

148148
Now that the storage emulator is running, has files on the `unprocessed-pdf` container, and our app is running, we can execute the `process_blob_upload` function to simulate a new blob event.
149149

150-
+ If you are using VS Code, Visual Studio, or other tooling that supports .http files, you can open the [`test.http`](./test.http) project file, update the port on the `localhost` URL (if needed), and then click on Send Request to call the locally running `process_blob_upload` function. This will trigger the function to process the `Benefit_Options.pdf` file. You can update the file name in the JSON to process other PDF files.
150+
+ If you are using VS Code, Visual Studio, or other tooling that supports .http files, you can open the [`test.http`](./test.http) project file, update the port in the `@host` variable (if needed), and then click on Send Request to call the locally running `process_blob_upload` function. This will trigger the function to process the `PerksPlus.pdf` file by default. You can update the `@blobName` variable to process other PDF files from the data folder.
151+
152+
The `test.http` file uses REST Client variable syntax to make testing easier:
153+
- `@host`: The base URL for your locally running function (default: `http://localhost:7071`)
154+
- `@functionName`: The name of the function to trigger (`process_blob_upload`)
155+
- `@blobContainer`: The source blob container (`unprocessed-pdf`)
156+
- `@blobName`: The specific blob file to process (default: `PerksPlus.pdf`)
157+
158+
Make sure the file specified in `@blobName` exists in the `unprocessed-pdf` container before triggering the function.
151159

152160
## Source Code
153161

154162
The function code for the `process_blob_upload` endpoint is defined in [`function_app.py`](./src/function_app.py). The function uses the Python v2 programming model and the `@app.blob_trigger()` decorator to register the blob trigger with Event Grid source.
155163
156164
```python
157-
@app.blob_trigger(arg_name="blob",
165+
@app.blob_trigger(arg_name="input_blob",
158166
path="unprocessed-pdf/{name}",
159167
connection="PDFProcessorSTORAGE",
160-
source="EventGrid")
161-
def process_blob_upload(blob: func.InputStream) -> None:
168+
source=func.BlobSource.EVENT_GRID)
169+
@app.blob_input(arg_name="processed_container",
170+
path="processed-pdf",
171+
connection="PDFProcessorSTORAGE")
172+
def process_blob_upload(input_blob: func.InputStream, processed_container: blob.ContainerClient) -> None:
162173
# Function implementation
163174
```
164175
165-
The `copy_to_processed_container` method uses the Azure Storage Blob SDK to upload the processed file to the destination blob container.
176+
The function uses Azure Functions SDK type bindings with a `ContainerClient` input binding to upload the processed file to the destination blob container.
166177
167178
## Deploy to Azure
168179

0 commit comments

Comments
 (0)