zyppnotify


Namezyppnotify JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/zypp-io/zyppnotify
SummarySend users notifications through various platforms
upload_time2024-10-07 06:53:19
maintainerNone
docs_urlNone
authorZypp
requires_python>=3.9
licenseNone
keywords python notifications teams e-mail
VCS
bugtrack_url
requirements azure-identity Babel msgraph-core msgraph-sdk pandas pympler tabulate
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div style="text-align:center"><img alt="logo" src="https://www.zypp.io/static/assets/img/logos/zypp/white/500px.png" width="200"></div>
<br>

[![Downloads](https://pepy.tech/badge/zyppnotify)](https://pepy.tech/project/zyppnotify)
[![PyPI version](https://badge.fury.io/py/zyppnotify.svg)](https://badge.fury.io/py/zyppnotify)
[![Open Source](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://opensource.org/)

Notify
===
> Sending mails and teams messages in a smart way. This project makes it easy to send basic messages through Teams or Email.

# Installation

---

```commandline
pip install zyppnotify
```

## Notify Mail
When using the `NotifyMail` class, the environment variables `EMAIL_USER` (mailadress you want to mail with), `MAIL_TENANT_ID`, `MAIL_CLIENT_ID` and `MAIL_CLIENT_SECRET` (3x App registration credentials with User.Read.All permission with admin consent to authenticate to MS Graph) need to be set.
The initialization of this class will return an error if one of thes variables is not set.

```python
from notify import NotifyMail, NotifyTeams

# versturen van een basis bericht met onderwerp en tekst
mail = NotifyMail(to="reveiver@domain.com",
                  subject="Notify me!",
                  message="This is a test message, send through the notify package")

mail.send_email()
```

## Notify Teams
For the Notify for Teams (1.0.0) you can create a webhook as by following the steps in the [Microsoft documentation](https://support.microsoft.com/en-us/office/create-incoming-webhooks-with-workflows-for-microsoft-teams-8ae491c7-0394-4861-ba59-055e33f75498).

Requirement: Add member that sends the message to the channel

In the workflow app, make sure the message is sent as user, and not as Flowbot.
```python
from notify import NotifyTeams
from notify.tests import import_sample_dfs

webhook = ("REPLACE_ME")

teams = NotifyTeams(webhook=webhook)

# versturen van een basis bericht met onderwerp en tekst
teams.basic_message(title="Notify me!",
                    message="This is a test message, send through the notify package")

# versturen van een uitgebreid rapport over dataframes.
dfs = import_sample_dfs()
teams.basic_message(title="Notify me!",
                    message="This is optional",
                    buttons={"button_name": "https://www.my_link.nl"},
                    dfs=dfs) #  creates a report on the dataframes processed.
```
 ### Add extra elements to Teams message
With the parameter `extra` the user can add adaptive cards elements to the message. The `extra` parameter should be a
list of dictionaries. The dictionaries should contain the keys `index` and `item`. The `index` key should be an integer
and the `item` key should be a dictionary containing the adaptive card element. The `index` key determines the location
in the message.

```python
from notify import NotifyTeams

webhook = ("REPLACE_ME")

teams = NotifyTeams(webhook=webhook)

extra_item = {"type": "TextBlock", "color": "good", "text": "This is extra text in green", "wrap": "true"}
teams.basic_message(title="Notify me!",
                    message="This is optional",
                    buttons={"button_name": "https://www.my_link.nl"},
                    extra=[{"index": 3, "item": extra_item}]) #  creates a report on the dataframes processed.
```

With the method `create_adaptive_card_dataframe(df)` you can create an Adaptive Card dataframe to be added as an extra element.
```python
from notify import NotifyTeams
from notify.tests import import_sample_dfs

webhook = ("REPLACE_ME")

teams = NotifyTeams(webhook=webhook)
df = import_sample_dfs().get("Transactions")
extra_df = teams.create_adaptive_card_dataframe(df)
teams.basic_message(title="Notify me!",
                    message="This is optional",
                    buttons={"button_name": "https://www.my_link.nl"},
                    extra=[{"index": 3, "item": extra_df}]) #  creates a report on the dataframes processed.
```

## Notify utils
```python
from notify import format_numbers, dataframe_to_html
from notify.tests import import_sample_dfs

df = import_sample_dfs().get("Transactions")

# format numbers and currencies using dutch locale
df = format_numbers(df, currency_columns=["amount"], number_columns=[])
html_table = dataframe_to_html(df)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zypp-io/zyppnotify",
    "name": "zyppnotify",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "python, notifications, teams, e-mail",
    "author": "Zypp",
    "author_email": "hello@zypp.io",
    "download_url": "https://files.pythonhosted.org/packages/9c/4e/d27eeba35920b4c479e0b6b0acf2bc12bc893a7355dd2e3739b6310e0899/zyppnotify-1.0.1.tar.gz",
    "platform": null,
    "description": "<div style=\"text-align:center\"><img alt=\"logo\" src=\"https://www.zypp.io/static/assets/img/logos/zypp/white/500px.png\" width=\"200\"></div>\n<br>\n\n[![Downloads](https://pepy.tech/badge/zyppnotify)](https://pepy.tech/project/zyppnotify)\n[![PyPI version](https://badge.fury.io/py/zyppnotify.svg)](https://badge.fury.io/py/zyppnotify)\n[![Open Source](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://opensource.org/)\n\nNotify\n===\n> Sending mails and teams messages in a smart way. This project makes it easy to send basic messages through Teams or Email.\n\n# Installation\n\n---\n\n```commandline\npip install zyppnotify\n```\n\n## Notify Mail\nWhen using the `NotifyMail` class, the environment variables `EMAIL_USER` (mailadress you want to mail with), `MAIL_TENANT_ID`, `MAIL_CLIENT_ID` and `MAIL_CLIENT_SECRET` (3x App registration credentials with User.Read.All permission with admin consent to authenticate to MS Graph) need to be set.\nThe initialization of this class will return an error if one of thes variables is not set.\n\n```python\nfrom notify import NotifyMail, NotifyTeams\n\n# versturen van een basis bericht met onderwerp en tekst\nmail = NotifyMail(to=\"reveiver@domain.com\",\n                  subject=\"Notify me!\",\n                  message=\"This is a test message, send through the notify package\")\n\nmail.send_email()\n```\n\n## Notify Teams\nFor the Notify for Teams (1.0.0) you can create a webhook as by following the steps in the [Microsoft documentation](https://support.microsoft.com/en-us/office/create-incoming-webhooks-with-workflows-for-microsoft-teams-8ae491c7-0394-4861-ba59-055e33f75498).\n\nRequirement: Add member that sends the message to the channel\n\nIn the workflow app, make sure the message is sent as user, and not as Flowbot.\n```python\nfrom notify import NotifyTeams\nfrom notify.tests import import_sample_dfs\n\nwebhook = (\"REPLACE_ME\")\n\nteams = NotifyTeams(webhook=webhook)\n\n# versturen van een basis bericht met onderwerp en tekst\nteams.basic_message(title=\"Notify me!\",\n                    message=\"This is a test message, send through the notify package\")\n\n# versturen van een uitgebreid rapport over dataframes.\ndfs = import_sample_dfs()\nteams.basic_message(title=\"Notify me!\",\n                    message=\"This is optional\",\n                    buttons={\"button_name\": \"https://www.my_link.nl\"},\n                    dfs=dfs) #  creates a report on the dataframes processed.\n```\n ### Add extra elements to Teams message\nWith the parameter `extra` the user can add adaptive cards elements to the message. The `extra` parameter should be a\nlist of dictionaries. The dictionaries should contain the keys `index` and `item`. The `index` key should be an integer\nand the `item` key should be a dictionary containing the adaptive card element. The `index` key determines the location\nin the message.\n\n```python\nfrom notify import NotifyTeams\n\nwebhook = (\"REPLACE_ME\")\n\nteams = NotifyTeams(webhook=webhook)\n\nextra_item = {\"type\": \"TextBlock\", \"color\": \"good\", \"text\": \"This is extra text in green\", \"wrap\": \"true\"}\nteams.basic_message(title=\"Notify me!\",\n                    message=\"This is optional\",\n                    buttons={\"button_name\": \"https://www.my_link.nl\"},\n                    extra=[{\"index\": 3, \"item\": extra_item}]) #  creates a report on the dataframes processed.\n```\n\nWith the method `create_adaptive_card_dataframe(df)` you can create an Adaptive Card dataframe to be added as an extra element.\n```python\nfrom notify import NotifyTeams\nfrom notify.tests import import_sample_dfs\n\nwebhook = (\"REPLACE_ME\")\n\nteams = NotifyTeams(webhook=webhook)\ndf = import_sample_dfs().get(\"Transactions\")\nextra_df = teams.create_adaptive_card_dataframe(df)\nteams.basic_message(title=\"Notify me!\",\n                    message=\"This is optional\",\n                    buttons={\"button_name\": \"https://www.my_link.nl\"},\n                    extra=[{\"index\": 3, \"item\": extra_df}]) #  creates a report on the dataframes processed.\n```\n\n## Notify utils\n```python\nfrom notify import format_numbers, dataframe_to_html\nfrom notify.tests import import_sample_dfs\n\ndf = import_sample_dfs().get(\"Transactions\")\n\n# format numbers and currencies using dutch locale\ndf = format_numbers(df, currency_columns=[\"amount\"], number_columns=[])\nhtml_table = dataframe_to_html(df)\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Send users notifications through various platforms",
    "version": "1.0.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/zypp-io/zyppnotify/issues",
        "Homepage": "https://github.com/zypp-io/zyppnotify",
        "Source": "https://github.com/zypp-io/zyppnotify"
    },
    "split_keywords": [
        "python",
        " notifications",
        " teams",
        " e-mail"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6199ebf2ee5cd55183747bc4a65969a68dfa072d2a5a54645ac8fe402bdcfc87",
                "md5": "fc58656696cd2be919cc20d4baa3e49b",
                "sha256": "2ca3a83dde6fac168521ded87920f75e6a16fb52fe3b9431e10c40dfd538b7a6"
            },
            "downloads": -1,
            "filename": "zyppnotify-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fc58656696cd2be919cc20d4baa3e49b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 11397,
            "upload_time": "2024-10-07T06:53:17",
            "upload_time_iso_8601": "2024-10-07T06:53:17.601176Z",
            "url": "https://files.pythonhosted.org/packages/61/99/ebf2ee5cd55183747bc4a65969a68dfa072d2a5a54645ac8fe402bdcfc87/zyppnotify-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9c4ed27eeba35920b4c479e0b6b0acf2bc12bc893a7355dd2e3739b6310e0899",
                "md5": "1b909f3bd11d44e8306832011487c88e",
                "sha256": "d3244953b72c9117a68f0ff6350c51e112cb1d6a95d4f8cbaec6a1f551d011a3"
            },
            "downloads": -1,
            "filename": "zyppnotify-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1b909f3bd11d44e8306832011487c88e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 11718,
            "upload_time": "2024-10-07T06:53:19",
            "upload_time_iso_8601": "2024-10-07T06:53:19.228229Z",
            "url": "https://files.pythonhosted.org/packages/9c/4e/d27eeba35920b4c479e0b6b0acf2bc12bc893a7355dd2e3739b6310e0899/zyppnotify-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-07 06:53:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zypp-io",
    "github_project": "zyppnotify",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "azure-identity",
            "specs": [
                [
                    ">=",
                    "1.16.1"
                ]
            ]
        },
        {
            "name": "Babel",
            "specs": [
                [
                    ">=",
                    "2.14.0"
                ]
            ]
        },
        {
            "name": "msgraph-core",
            "specs": [
                [
                    ">=",
                    "1.1.3"
                ]
            ]
        },
        {
            "name": "msgraph-sdk",
            "specs": [
                [
                    "~=",
                    "1.5.4"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "2.2.2"
                ]
            ]
        },
        {
            "name": "pympler",
            "specs": [
                [
                    "~=",
                    "1.1"
                ]
            ]
        },
        {
            "name": "tabulate",
            "specs": [
                [
                    ">=",
                    "0.8.10"
                ]
            ]
        }
    ],
    "lcname": "zyppnotify"
}
        
Elapsed time: 0.31128s