django-streaming 0.1__tar.gz → 0.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.
- {django_streaming-0.1 → django_streaming-0.3}/PKG-INFO +1 -1
- {django_streaming-0.1 → django_streaming-0.3}/src/streaming/backends/rabbitmq.py +9 -2
- {django_streaming-0.1 → django_streaming-0.3}/src/streaming/version.py +2 -2
- {django_streaming-0.1 → django_streaming-0.3}/.gitignore +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/LICENSE +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/README.md +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/pyproject.toml +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/src/streaming/__cli__.py +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/src/streaming/api.py +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/src/streaming/apps.py +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/src/streaming/backends/__init__.py +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/src/streaming/backends/_base.py +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/src/streaming/backends/console.py +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/src/streaming/backends/debug.py +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/src/streaming/backends/redis.py +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/src/streaming/config.py +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/src/streaming/exceptions.py +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/src/streaming/handlers.py +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/src/streaming/manager.py +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/src/streaming/py.typed +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/src/streaming/types.pyi +0 -0
- {django_streaming-0.1 → django_streaming-0.3}/src/streaming/utils.py +0 -0
|
@@ -7,6 +7,7 @@ from typing import TYPE_CHECKING
|
|
|
7
7
|
|
|
8
8
|
import pika.channel
|
|
9
9
|
import pika.exceptions
|
|
10
|
+
from pika import PlainCredentials
|
|
10
11
|
from pika.exchange_type import ExchangeType
|
|
11
12
|
|
|
12
13
|
from streaming.config import CONFIG
|
|
@@ -47,11 +48,16 @@ class RabbitMQBackend(BaseBackend):
|
|
|
47
48
|
|
|
48
49
|
for __ in range(CONFIG.RETRY_COUNT):
|
|
49
50
|
try:
|
|
51
|
+
if self._parsed_url.username:
|
|
52
|
+
auth = PlainCredentials(self._parsed_url.username, self._parsed_url.password or "")
|
|
53
|
+
else:
|
|
54
|
+
auth = PlainCredentials("guest", "guest")
|
|
50
55
|
self.connection = pika.BlockingConnection(
|
|
51
56
|
pika.ConnectionParameters(
|
|
52
57
|
host=self.host,
|
|
53
58
|
port=self.port,
|
|
54
59
|
virtual_host=self.virtual_host,
|
|
60
|
+
credentials=auth,
|
|
55
61
|
socket_timeout=self.timeout,
|
|
56
62
|
blocked_connection_timeout=self.timeout,
|
|
57
63
|
stack_timeout=self.timeout,
|
|
@@ -75,12 +81,13 @@ class RabbitMQBackend(BaseBackend):
|
|
|
75
81
|
time.sleep(CONFIG.RETRY_DELAY)
|
|
76
82
|
logger.critical("Could not connect to RabbitMQ after multiple retries.")
|
|
77
83
|
|
|
78
|
-
def listen(self, domains: list[str], callback: "PikaCallback") -> None:
|
|
84
|
+
def listen(self, domains: list[str], callback: "PikaCallback", ack: bool = True) -> None:
|
|
79
85
|
def _callback(
|
|
80
86
|
ch: "BlockingChannel", method: "Basic.Deliver", properties: "BasicProperties", body: bytes
|
|
81
87
|
) -> None:
|
|
82
88
|
callback(ch, method, properties, body)
|
|
83
|
-
|
|
89
|
+
if ack:
|
|
90
|
+
ch.basic_ack(delivery_tag=method.delivery_tag) # type: ignore[arg-type]
|
|
84
91
|
|
|
85
92
|
if self.channel is None:
|
|
86
93
|
self.connect()
|
|
@@ -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.
|
|
32
|
-
__version_tuple__ = version_tuple = (0,
|
|
31
|
+
__version__ = version = '0.3'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 3)
|
|
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
|
|
File without changes
|
|
File without changes
|