Luke Tainton
9830c5cc3a
* chore(pip-prod)(deps): bump pyparsing from 3.1.1 to 3.1.2 Bumps [pyparsing](https://github.com/pyparsing/pyparsing) from 3.1.1 to 3.1.2. - [Release notes](https://github.com/pyparsing/pyparsing/releases) - [Changelog](https://github.com/pyparsing/pyparsing/blob/master/CHANGES) - [Commits](https://github.com/pyparsing/pyparsing/compare/3.1.1...pyparsing_3.1.2) --- updated-dependencies: - dependency-name: pyparsing dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * chore(pip-prod)(deps): bump packaging from 23.2 to 24.0 Bumps [packaging](https://github.com/pypa/packaging) from 23.2 to 24.0. - [Release notes](https://github.com/pypa/packaging/releases) - [Changelog](https://github.com/pypa/packaging/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pypa/packaging/compare/23.2...24.0) --- updated-dependencies: - dependency-name: packaging dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * chore(actions)(deps): bump mathieudutour/github-tag-action Bumps [mathieudutour/github-tag-action](https://github.com/mathieudutour/github-tag-action) from 6.1 to 6.2. - [Release notes](https://github.com/mathieudutour/github-tag-action/releases) - [Commits](https://github.com/mathieudutour/github-tag-action/compare/v6.1...v6.2) --- updated-dependencies: - dependency-name: mathieudutour/github-tag-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * chore(pip-prod)(deps): bump autopep8 from 2.0.4 to 2.1.0 Bumps [autopep8](https://github.com/hhatto/autopep8) from 2.0.4 to 2.1.0. - [Release notes](https://github.com/hhatto/autopep8/releases) - [Commits](https://github.com/hhatto/autopep8/compare/v2.0.4...v2.1.0) --- updated-dependencies: - dependency-name: autopep8 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * chore(pip-prod)(deps): bump filelock from 3.13.1 to 3.13.2 Bumps [filelock](https://github.com/tox-dev/py-filelock) from 3.13.1 to 3.13.2. - [Release notes](https://github.com/tox-dev/py-filelock/releases) - [Changelog](https://github.com/tox-dev/filelock/blob/main/docs/changelog.rst) - [Commits](https://github.com/tox-dev/py-filelock/compare/3.13.1...3.13.2) --- updated-dependencies: - dependency-name: filelock dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * chore(pip-prod)(deps): bump filelock from 3.13.2 to 3.13.3 Bumps [filelock](https://github.com/tox-dev/py-filelock) from 3.13.2 to 3.13.3. - [Release notes](https://github.com/tox-dev/py-filelock/releases) - [Changelog](https://github.com/tox-dev/filelock/blob/main/docs/changelog.rst) - [Commits](https://github.com/tox-dev/py-filelock/compare/3.13.2...3.13.3) --- updated-dependencies: - dependency-name: filelock dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * chore(pip-prod)(deps): bump filelock from 3.13.3 to 3.13.4 Bumps [filelock](https://github.com/tox-dev/py-filelock) from 3.13.3 to 3.13.4. - [Release notes](https://github.com/tox-dev/py-filelock/releases) - [Changelog](https://github.com/tox-dev/filelock/blob/main/docs/changelog.rst) - [Commits](https://github.com/tox-dev/py-filelock/compare/3.13.3...3.13.4) --- updated-dependencies: - dependency-name: filelock dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * chore(pip-prod)(deps): bump idna from 3.6 to 3.7 Bumps [idna](https://github.com/kjd/idna) from 3.6 to 3.7. - [Release notes](https://github.com/kjd/idna/releases) - [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.rst) - [Commits](https://github.com/kjd/idna/compare/v3.6...v3.7) --- updated-dependencies: - dependency-name: idna dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * chore(pip-prod)(deps): bump virtualenv from 20.25.1 to 20.25.3 Bumps [virtualenv](https://github.com/pypa/virtualenv) from 20.25.1 to 20.25.3. - [Release notes](https://github.com/pypa/virtualenv/releases) - [Changelog](https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst) - [Commits](https://github.com/pypa/virtualenv/compare/20.25.1...20.25.3) --- updated-dependencies: - dependency-name: virtualenv dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Add APM (#184) * Add APM * Fix unit tests * Remove apm.py * Add SonarCloud recommendations * SonarCloud python:S6890 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
70 lines
1.8 KiB
Python
70 lines
1.8 KiB
Python
import requests
|
|
import sentry_sdk
|
|
|
|
from app.utils.config import config
|
|
|
|
|
|
def __n8n_post(data: dict) -> bool:
|
|
"""Post data to N8N webhook URL.
|
|
|
|
Args:
|
|
data (dict): Data to post to webhook URL.
|
|
|
|
Returns:
|
|
bool: True if successful, else False.
|
|
"""
|
|
headers: dict = {"Content-Type": "application/json"}
|
|
resp: requests.Response = requests.post(
|
|
url=config.n8n_webhook_url,
|
|
headers=headers,
|
|
json=data,
|
|
timeout=10,
|
|
verify=False,
|
|
)
|
|
return bool(resp.status_code == 200)
|
|
|
|
|
|
def submit_task(summary, description, completion_date, requestor) -> bool:
|
|
"""Submit task to N8N webhook URL.
|
|
|
|
Args:
|
|
summary (str): Summary of task.
|
|
description (str): Description of task.
|
|
completion_date (str): Completion date of task.
|
|
requestor (str): Requestor of task.
|
|
|
|
Returns:
|
|
bool: True if successful, else False.
|
|
"""
|
|
with sentry_sdk.start_transaction(name="submit_task"):
|
|
data: dict = {
|
|
"requestor": requestor,
|
|
"title": summary,
|
|
"description": description,
|
|
"completiondate": completion_date,
|
|
}
|
|
_data = __n8n_post(data=data)
|
|
return _data
|
|
|
|
|
|
def get_tasks(requestor) -> bool:
|
|
"""Get tasks from N8N webhook URL.
|
|
|
|
Args:
|
|
requestor (str): Requestor of tasks.
|
|
|
|
Returns:
|
|
bool: True if successful, else False.
|
|
"""
|
|
with sentry_sdk.start_transaction(name="get_tasks"):
|
|
headers: dict = {"Content-Type": "application/json"}
|
|
resp: requests.Response = requests.get(
|
|
url=config.n8n_webhook_url,
|
|
headers=headers,
|
|
timeout=10,
|
|
verify=False,
|
|
params={"requestor": requestor},
|
|
)
|
|
_data = bool(resp.status_code == 200)
|
|
return _data
|