django-streaming 0.7__tar.gz → 0.7.1__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.
- {django_streaming-0.7 → django_streaming-0.7.1}/PKG-INFO +1 -1
- {django_streaming-0.7 → django_streaming-0.7.1}/src/streaming/__cli__.py +1 -1
- {django_streaming-0.7 → django_streaming-0.7.1}/src/streaming/event.py +4 -2
- {django_streaming-0.7 → django_streaming-0.7.1}/src/streaming/utils.py +10 -4
- {django_streaming-0.7 → django_streaming-0.7.1}/src/streaming/version.py +2 -2
- {django_streaming-0.7 → django_streaming-0.7.1}/.gitignore +0 -0
- {django_streaming-0.7 → django_streaming-0.7.1}/LICENSE +0 -0
- {django_streaming-0.7 → django_streaming-0.7.1}/README.md +0 -0
- {django_streaming-0.7 → django_streaming-0.7.1}/pyproject.toml +0 -0
- {django_streaming-0.7 → django_streaming-0.7.1}/src/streaming/__init__.py +0 -0
- {django_streaming-0.7 → django_streaming-0.7.1}/src/streaming/apps.py +0 -0
- {django_streaming-0.7 → django_streaming-0.7.1}/src/streaming/backends/__init__.py +0 -0
- {django_streaming-0.7 → django_streaming-0.7.1}/src/streaming/backends/_base.py +0 -0
- {django_streaming-0.7 → django_streaming-0.7.1}/src/streaming/backends/console.py +0 -0
- {django_streaming-0.7 → django_streaming-0.7.1}/src/streaming/backends/debug.py +0 -0
- {django_streaming-0.7 → django_streaming-0.7.1}/src/streaming/backends/rabbitmq.py +0 -0
- {django_streaming-0.7 → django_streaming-0.7.1}/src/streaming/callbacks.py +0 -0
- {django_streaming-0.7 → django_streaming-0.7.1}/src/streaming/config.py +0 -0
- {django_streaming-0.7 → django_streaming-0.7.1}/src/streaming/exceptions.py +0 -0
- {django_streaming-0.7 → django_streaming-0.7.1}/src/streaming/manager.py +0 -0
- {django_streaming-0.7 → django_streaming-0.7.1}/src/streaming/py.typed +0 -0
- {django_streaming-0.7 → django_streaming-0.7.1}/src/streaming/types.py +0 -0
|
@@ -109,7 +109,7 @@ def send(routing_key: str, message: str, client_name: str, debug: bool) -> None:
|
|
|
109
109
|
payload = {
|
|
110
110
|
"message": message,
|
|
111
111
|
}
|
|
112
|
-
msg: Event = make_event(payload, key="Test")
|
|
112
|
+
msg: Event = make_event(message=payload, key="Test")
|
|
113
113
|
backend.publish(routing_key, msg)
|
|
114
114
|
click.secho(f"Sent: {msg}")
|
|
115
115
|
backend.disconnect()
|
|
@@ -47,12 +47,14 @@ class Event:
|
|
|
47
47
|
)
|
|
48
48
|
|
|
49
49
|
@classmethod
|
|
50
|
-
def build(
|
|
50
|
+
def build(
|
|
51
|
+
cls, data: Any, value_type: "EventType" = "absolute", key: str = "N/A", message_id: str | None = None
|
|
52
|
+
) -> "Event":
|
|
51
53
|
if isinstance(data, str):
|
|
52
54
|
payload: JSON = {"message": data}
|
|
53
55
|
else:
|
|
54
56
|
payload = data
|
|
55
|
-
return cls(key=key, payload=payload, value_type=value_type)
|
|
57
|
+
return cls(key=key, payload=payload, value_type=value_type, message_id=message_id)
|
|
56
58
|
|
|
57
59
|
def as_dict(self) -> dict[str, Any]:
|
|
58
60
|
return {
|
|
@@ -10,11 +10,10 @@ from django.db import models
|
|
|
10
10
|
from pika.adapters.blocking_connection import BlockingChannel
|
|
11
11
|
from pika.exceptions import ChannelClosedByBroker
|
|
12
12
|
|
|
13
|
-
from streaming.types import UserCallback
|
|
13
|
+
from streaming.types import JSON, EventType, UserCallback
|
|
14
14
|
|
|
15
15
|
if TYPE_CHECKING:
|
|
16
16
|
from streaming.event import Event
|
|
17
|
-
from streaming.types import JSON
|
|
18
17
|
|
|
19
18
|
MINUTE = 60
|
|
20
19
|
HOUR = MINUTE * 60
|
|
@@ -52,10 +51,17 @@ def parse_bool(value: Any) -> bool:
|
|
|
52
51
|
return value in [1, True]
|
|
53
52
|
|
|
54
53
|
|
|
55
|
-
def make_event(
|
|
54
|
+
def make_event(
|
|
55
|
+
message: "str|JSON", *, value_type: "EventType" = "absolute", key: str = "N/A", message_id: str | None = None
|
|
56
|
+
) -> "Event":
|
|
56
57
|
from streaming.event import Event
|
|
57
58
|
|
|
58
|
-
return Event.build(
|
|
59
|
+
return Event.build(
|
|
60
|
+
key=key,
|
|
61
|
+
data=message,
|
|
62
|
+
value_type=value_type,
|
|
63
|
+
message_id=message_id,
|
|
64
|
+
)
|
|
59
65
|
|
|
60
66
|
|
|
61
67
|
def get_local_ip() -> str:
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.7'
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 7)
|
|
31
|
+
__version__ = version = '0.7.1'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 7, 1)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|