-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
57337d9
commit 8e8cd4d
Showing
8 changed files
with
54 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ This is definitely an easy function, I believe many guys have written their own | |
|
||
## Installation | ||
```bash | ||
pip install py_reminder==1.0.1 | ||
pip install py_reminder==1.0.2 | ||
``` | ||
|
||
## Initial configuration | ||
|
@@ -51,6 +51,17 @@ If you want to specify the receiver: | |
@monitor(task='This is a task', to='[email protected]') | ||
``` | ||
|
||
If you would like to only send email when error caught: | ||
```python | ||
@monitor(task='This is a task', mute_success=True) | ||
``` | ||
|
||
If you would like to switch on and off the notification as a whole: | ||
```python | ||
arg = True | ||
@monitor(task='This is a task', disable=arg) | ||
``` | ||
|
||
Another way to use it without decorator: | ||
```python | ||
from py_reminder import send_email | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
[project] | ||
name = "py_reminder" | ||
version = "1.0.1" | ||
version = "1.0.2" | ||
authors = [ | ||
{ name="Wenzhi Ding", email="[email protected]" }, | ||
] | ||
description = "A convenient email sender for monitoring your task" | ||
readme = "README.md" | ||
requires-python = ">=3.7" | ||
requires-python = ">=3.6" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from py_reminder import monitor | ||
|
||
@monitor('This success should be disabled', disable=True) | ||
def foo(a=3, b=4): | ||
return a + b | ||
|
||
@monitor('This error should be disabled', disable=True) | ||
def err_foo(a=3, b=4): | ||
raise Exception('This is an error') | ||
|
||
r = foo(4, b=1) | ||
print(r) | ||
|
||
r = err_foo(4, b=1) | ||
print(r) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from py_reminder import monitor | ||
|
||
@monitor('This success should be muted', mute_success=True) | ||
def foo(a=3, b=4): | ||
return a + b | ||
|
||
@monitor('This error should not be disabled', mute_success=True) | ||
def err_foo(a=3, b=4): | ||
raise Exception('This is an error') | ||
|
||
r = foo(4, b=1) | ||
print(r) | ||
|
||
r = err_foo(4, b=1) | ||
print(r) |