Skip to content

Commit

Permalink
Adds article title as message preview (#12)
Browse files Browse the repository at this point in the history
Also improves READMEs and updates to new version of Azure's text analytics library
  • Loading branch information
Phuurl authored Jun 1, 2022
1 parent ad2a9b1 commit d977bff
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"ms-azuretools.vscode-azurefunctions",
"ms-python.python"
]
}
12 changes: 12 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Python Functions",
"type": "python",
"request": "attach",
"port": 9091,
"preLaunchTask": "func: host start"
}
]
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"azureFunctions.deploySubpath": "functions",
"azureFunctions.scmDoBuildDuringDeployment": true,
"azureFunctions.pythonVenv": ".venv",
"azureFunctions.projectLanguage": "Python",
"azureFunctions.projectRuntime": "~4",
"debug.internalConsoleOptions": "neverOpen"
}
32 changes: 32 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "func",
"command": "host start",
"problemMatcher": "$func-python-watch",
"isBackground": true,
"dependsOn": "pip install (functions)",
"options": {
"cwd": "${workspaceFolder}/functions"
}
},
{
"label": "pip install (functions)",
"type": "shell",
"osx": {
"command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt"
},
"windows": {
"command": "${config:azureFunctions.pythonVenv}\\Scripts\\python -m pip install -r requirements.txt"
},
"linux": {
"command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt"
},
"problemMatcher": [],
"options": {
"cwd": "${workspaceFolder}/functions"
}
}
]
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ An Azure Function and associated resources that takes RSS feeds of cloud news (e

The Function polls the relevant RSS feeds every 30 minutes.

It is expected that both the Function and the Language Cognitive Services usage will fall within the free tier on Azure, or have very low cost (cents per month). Other resource usage is negligible and will likely also be free. For additional pricing information, see
It is expected that the total usage cost of all the included resources (Functions, Storage Accounts, and Language Cognitive Services) will be approximately $1/month. For additional pricing information, see
- [Functions pricing](https://azure.microsoft.com/en-us/pricing/details/functions/)
- [Storage Account pricing](https://azure.microsoft.com/en-gb/pricing/details/storage/)
- [Language Cognitive Services pricing](https://azure.microsoft.com/en-gb/pricing/details/cognitive-services/language-service/)

## Architecture
Expand Down
4 changes: 2 additions & 2 deletions functions/PostHandler/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# AwsPostHandler
# PostHandler
Uses BeautifulSoup to parse news posts picked up from the `PROCESS_QUEUE_NAME` storage queue, sends the main post content to Azure's text summarization service, and posts the result to Slack (with the `{CLOUD}_SLACK_WEBHOOK` environment variable).

Expects an input from the queue message in the format `cloud§articleurl`.
Expects an input from the queue message in the format `cloud§articleurl` - eg `azure§https://azure.microsoft.com/en-gb/updates/public-preview-azure-cognitive-services-updates/`

Currently supports:
- AWS articles: https://aws.amazon.com/new/
Expand Down
1 change: 1 addition & 0 deletions functions/PostHandler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def main(msg: func.QueueMessage) -> None:
else:
logging.info("Summary:\n{}".format(" ".join([sentence.text for sentence in result[0].sentences])))
slack_blocks = {
"text": article["title"],
"blocks": [
{
"type": "section",
Expand Down
2 changes: 1 addition & 1 deletion functions/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

azure-functions

azure-ai-textanalytics~=5.2.0b3
azure-ai-textanalytics~=5.2.0b4
azure-data-tables~=12.3.0
azure-storage-queue~=12.2.0
beautifulsoup4~=4.11.1
Expand Down

0 comments on commit d977bff

Please sign in to comment.