python-ntfy 0.2.2__tar.gz → 0.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Matthew Cane
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,15 +1,22 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-ntfy
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: An ntfy library aiming for feature completeness
5
+ Home-page: https://github.com/MatthewCane/python-ntfy
6
+ License: MIT
5
7
  Author: Matthew Cane
6
8
  Author-email: matthew.cane0@gmail.com
7
9
  Requires-Python: >=3.11,<4.0
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
8
13
  Classifier: Programming Language :: Python :: 3
9
14
  Classifier: Programming Language :: Python :: 3.11
10
15
  Classifier: Programming Language :: Python :: 3.12
11
16
  Classifier: Programming Language :: Python :: 3.13
12
17
  Requires-Dist: requests (>=2.31.0,<3.0.0)
18
+ Project-URL: Documentation, https://matthewcane.github.io/python-ntfy/
19
+ Project-URL: Repository, https://github.com/MatthewCane/python-ntfy
13
20
  Description-Content-Type: text/markdown
14
21
 
15
22
  # A Python Library For ntfy.sh
@@ -20,13 +27,13 @@ An easy-to-use ntfy python library. Aiming for full feature support.
20
27
 
21
28
  1. Install using pip with `pip3 install python-ntfy`
22
29
  2. Configure the following environment variables:
23
- - `NTFY_USER`: The username for your server (if required)
24
- - `NTFY_PASSWORD`: The password for your server (if required)
25
- - `NTFY_SERVER`: The server URL (defaults to https://ntft.sh)
30
+ - `NTFY_USER`: The username for your server (if required)
31
+ - `NTFY_PASSWORD`: The password for your server (if required)
32
+ - `NTFY_SERVER`: The server URL (defaults to `https://ntft.sh`)
26
33
  3. Setup your application to use the library:
27
34
 
28
- ```python
29
- # Import the ntfy client
35
+ ```python
36
+ # Import the ntfy client
30
37
  from python_ntfy import NtfyClient
31
38
 
32
39
  # Create an `NtfyClient` instance with a topic
@@ -36,6 +43,8 @@ client = NtfyClient(topic="Your topic")
36
43
  client.send("Your message here")
37
44
  ```
38
45
 
46
+ See the full documentation site at [https://matthewcane.github.io/python-ntfy/](https://matthewcane.github.io/python-ntfy/).
47
+
39
48
  ## Supported Features
40
49
 
41
50
  - Username + password auth
@@ -44,13 +53,13 @@ client.send("Your message here")
44
53
  - Sending Markdown formatted text messages
45
54
  - Retrieving cached messages
46
55
  - Scheduled delivery
56
+ - Tags
57
+ - Action buttons
47
58
 
48
59
  ## Future Features
49
60
 
50
61
  - Access token auth
51
62
  - Email notifications
52
- - Tags
53
- - Action buttons
54
63
  - Send to multiple topics at once
55
64
 
56
65
  ## Test and Development
@@ -6,13 +6,13 @@ An easy-to-use ntfy python library. Aiming for full feature support.
6
6
 
7
7
  1. Install using pip with `pip3 install python-ntfy`
8
8
  2. Configure the following environment variables:
9
- - `NTFY_USER`: The username for your server (if required)
10
- - `NTFY_PASSWORD`: The password for your server (if required)
11
- - `NTFY_SERVER`: The server URL (defaults to https://ntft.sh)
9
+ - `NTFY_USER`: The username for your server (if required)
10
+ - `NTFY_PASSWORD`: The password for your server (if required)
11
+ - `NTFY_SERVER`: The server URL (defaults to `https://ntft.sh`)
12
12
  3. Setup your application to use the library:
13
13
 
14
- ```python
15
- # Import the ntfy client
14
+ ```python
15
+ # Import the ntfy client
16
16
  from python_ntfy import NtfyClient
17
17
 
18
18
  # Create an `NtfyClient` instance with a topic
@@ -22,6 +22,8 @@ client = NtfyClient(topic="Your topic")
22
22
  client.send("Your message here")
23
23
  ```
24
24
 
25
+ See the full documentation site at [https://matthewcane.github.io/python-ntfy/](https://matthewcane.github.io/python-ntfy/).
26
+
25
27
  ## Supported Features
26
28
 
27
29
  - Username + password auth
@@ -30,13 +32,13 @@ client.send("Your message here")
30
32
  - Sending Markdown formatted text messages
31
33
  - Retrieving cached messages
32
34
  - Scheduled delivery
35
+ - Tags
36
+ - Action buttons
33
37
 
34
38
  ## Future Features
35
39
 
36
40
  - Access token auth
37
41
  - Email notifications
38
- - Tags
39
- - Action buttons
40
42
  - Send to multiple topics at once
41
43
 
42
44
  ## Test and Development
@@ -1,9 +1,16 @@
1
1
  [tool.poetry]
2
2
  name = "python-ntfy"
3
- version = "0.2.2"
3
+ version = "0.2.3"
4
4
  description = "An ntfy library aiming for feature completeness"
5
5
  authors = ["Matthew Cane <matthew.cane0@gmail.com>"]
6
6
  readme = "README.md"
7
+ license = "MIT"
8
+ repository = "https://github.com/MatthewCane/python-ntfy"
9
+ documentation = "https://matthewcane.github.io/python-ntfy/"
10
+ classifiers = [
11
+ "Development Status :: 4 - Beta",
12
+ "Intended Audience :: Developers"
13
+ ]
7
14
 
8
15
  [tool.poetry.dependencies]
9
16
  python = "^3.11"
@@ -15,6 +22,8 @@ python-dotenv = "^1.0.0"
15
22
  pytest-asyncio = ">=0.21.1,<0.25.0"
16
23
  pytest-codecov = ">=0.5.1,<0.7.0"
17
24
  ruff = "^0.7.0"
25
+ mkdocs-material = "^9.5.41"
26
+ mkdocstrings-python = "^1.12.1"
18
27
 
19
28
  [build-system]
20
29
  requires = ["poetry-core"]
@@ -2,7 +2,9 @@ import json
2
2
  import requests
3
3
 
4
4
 
5
- def get_cached_messages(self, since: str = "all", scheduled: bool = False):
5
+ def get_cached_messages(
6
+ self, since: str = "all", scheduled: bool = False
7
+ ) -> list[dict]:
6
8
  """
7
9
  Get cached messages from the server
8
10
 
@@ -40,7 +40,7 @@ class ViewAction(Action):
40
40
  self.action = ActionType.VIEW
41
41
  super().__init__(label=label, url=url, clear=clear)
42
42
 
43
- def to_dict(self):
43
+ def to_dict(self) -> dict:
44
44
  return {
45
45
  "action": self.action.value,
46
46
  "label": self.label,
@@ -48,7 +48,7 @@ class ViewAction(Action):
48
48
  "clear": self.clear,
49
49
  }
50
50
 
51
- def to_header(self):
51
+ def to_header(self) -> str:
52
52
  return f"action={self.action.value}, label={self.label}, url={self.url}, clear={self.clear}"
53
53
 
54
54
 
@@ -65,7 +65,7 @@ class BroadcastAction(Action):
65
65
  self.extras = extras
66
66
  super().__init__(label, ActionType.BROADCAST, clear)
67
67
 
68
- def to_dict(self):
68
+ def to_dict(self) -> dict:
69
69
  return {
70
70
  "action": self.action.value,
71
71
  "label": self.label,
@@ -73,7 +73,7 @@ class BroadcastAction(Action):
73
73
  "clear": self.clear,
74
74
  }
75
75
 
76
- def to_header(self):
76
+ def to_header(self) -> str:
77
77
  extras = ""
78
78
  if self.extras is not None:
79
79
  for key, value in self.extras.items():
@@ -97,7 +97,7 @@ class HttpAction(Action):
97
97
  self.body = body
98
98
  super().__init__(label, url, clear)
99
99
 
100
- def to_dict(self):
100
+ def to_dict(self) -> dict:
101
101
  action_dict = {
102
102
  "action": self.action.value,
103
103
  "label": self.label,
@@ -111,7 +111,7 @@ class HttpAction(Action):
111
111
  action_dict["body"] = self.body
112
112
  return action_dict
113
113
 
114
- def to_header(self):
114
+ def to_header(self) -> str:
115
115
  header_str = f"action={self.action.value}, label={self.label}, url={self.url}, method={self.method}, clear={self.clear}"
116
116
  if self.headers is not None:
117
117
  headers = ""
@@ -132,7 +132,7 @@ def send(
132
132
  tags: list = [],
133
133
  actions: list[Union[ViewAction, BroadcastAction, HttpAction, None]] = [],
134
134
  format_as_markdown: bool = False,
135
- ):
135
+ ) -> dict:
136
136
  """
137
137
  Send a text based message to the server
138
138
 
@@ -171,7 +171,7 @@ def send_file(
171
171
  priority: Optional[MessagePriority] = MessagePriority.DEFAULT,
172
172
  tags: list = [],
173
173
  actions: list[Union[ViewAction, BroadcastAction, HttpAction, None]] = [],
174
- ):
174
+ ) -> dict:
175
175
  """
176
176
  Send a file to the server
177
177