rabbitpy 3.0.0__tar.gz → 3.0.2__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.
- rabbitpy-3.0.2/PKG-INFO +169 -0
- rabbitpy-3.0.2/README.md +141 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/pyproject.toml +2 -2
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/__init__.py +1 -1
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/io.py +4 -1
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/message.py +1 -1
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/test_message.py +6 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/uv.lock +584 -584
- rabbitpy-3.0.0/PKG-INFO +0 -78
- rabbitpy-3.0.0/README.rst +0 -50
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/.checkignore +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/.codeclimate.yml +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/.github/workflows/deploy.yaml +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/.github/workflows/docs.yaml +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/.github/workflows/testing.yaml +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/.gitignore +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/.pre-commit-config.yaml +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/CLAUDE.md +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/LICENSE +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/bootstrap +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/compose.yml +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/docs/api/connection.md +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/docs/api/exceptions.md +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/docs/examples/consumer.md +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/docs/examples/getter.md +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/docs/examples/publisher.md +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/docs/history.md +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/docs/index.md +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/docs/threads.md +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/examples/consumer.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/examples/getter.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/examples/publisher.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/examples/transactional_publisher.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/mkdocs.yml +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/amqp.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/amqp_queue.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/base.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/channel.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/channel0.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/connection.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/events.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/exceptions.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/exchange.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/heartbeat.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/py.typed +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/simple.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/state.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/tx.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/url_parser.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/rabbitpy/utils.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/__init__.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/data/ca.crt +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/data/client.crt +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/data/client.key +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/data/server.crt +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/data/server.key +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/helpers.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/integration/__init__.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/integration/test_connection.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/mixins.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/test_amqp.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/test_base.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/test_channel.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/test_channel0.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/test_connection.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/test_events.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/test_exchange.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/test_heartbeat.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/test_integration.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/test_io.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/test_queue.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/test_tx.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/test_url_parser.py +0 -0
- {rabbitpy-3.0.0 → rabbitpy-3.0.2}/tests/test_utils.py +0 -0
rabbitpy-3.0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rabbitpy
|
|
3
|
+
Version: 3.0.2
|
|
4
|
+
Summary: A pure python, thread-safe, minimalistic and pythonic RabbitMQ client library
|
|
5
|
+
Project-URL: Homepage, https://github.com/gmr/rabbitpy
|
|
6
|
+
Project-URL: Documentation, https://rabbitpy.readthedocs.io
|
|
7
|
+
Author-email: "Gavin M. Roy" <gavinmroy@gmail.com>
|
|
8
|
+
License-Expression: BSD-3-Clause
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: amqp,messaging,rabbitmq
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
21
|
+
Classifier: Topic :: Communications
|
|
22
|
+
Classifier: Topic :: Internet
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.11
|
|
26
|
+
Requires-Dist: pamqp<5.0,>=4.0
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# rabbitpy
|
|
30
|
+
|
|
31
|
+
A pure-Python, thread-safe, minimalistic RabbitMQ client library.
|
|
32
|
+
|
|
33
|
+
rabbitpy provides a straightforward API for working with RabbitMQ. Connections,
|
|
34
|
+
channels, queues, exchanges, and messages are plain Python objects. The library
|
|
35
|
+
handles the AMQP protocol details so you don't have to.
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install rabbitpy
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Requirements
|
|
44
|
+
|
|
45
|
+
- Python 3.11+
|
|
46
|
+
- RabbitMQ 3.8+
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
### Publish a message
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
import rabbitpy
|
|
54
|
+
|
|
55
|
+
with rabbitpy.Connection('amqp://guest:guest@localhost:5672/%2f') as conn:
|
|
56
|
+
with conn.channel() as channel:
|
|
57
|
+
exchange = rabbitpy.Exchange(channel, 'my-exchange')
|
|
58
|
+
exchange.declare()
|
|
59
|
+
|
|
60
|
+
queue = rabbitpy.Queue(channel, 'my-queue')
|
|
61
|
+
queue.declare()
|
|
62
|
+
queue.bind(exchange, 'my-routing-key')
|
|
63
|
+
|
|
64
|
+
message = rabbitpy.Message(channel, 'Hello, world!')
|
|
65
|
+
message.publish(exchange, 'my-routing-key')
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Consume messages
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
import rabbitpy
|
|
72
|
+
|
|
73
|
+
with rabbitpy.Connection('amqp://guest:guest@localhost:5672/%2f') as conn:
|
|
74
|
+
with conn.channel() as channel:
|
|
75
|
+
for message in rabbitpy.Queue(channel, 'my-queue'):
|
|
76
|
+
print(message.body)
|
|
77
|
+
message.ack()
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Get a single message
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
import rabbitpy
|
|
84
|
+
|
|
85
|
+
with rabbitpy.Connection('amqp://guest:guest@localhost:5672/%2f') as conn:
|
|
86
|
+
with conn.channel() as channel:
|
|
87
|
+
queue = rabbitpy.Queue(channel, 'my-queue')
|
|
88
|
+
message = queue.get()
|
|
89
|
+
if message:
|
|
90
|
+
print(message.body)
|
|
91
|
+
message.ack()
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Publish with confirmations
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
import rabbitpy
|
|
98
|
+
|
|
99
|
+
with rabbitpy.Connection('amqp://guest:guest@localhost:5672/%2f') as conn:
|
|
100
|
+
with conn.channel() as channel:
|
|
101
|
+
channel.enable_publisher_confirms()
|
|
102
|
+
message = rabbitpy.Message(channel, 'Hello, world!')
|
|
103
|
+
if message.publish('', routing_key='my-queue'):
|
|
104
|
+
print('Confirmed by broker')
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Transactional publishing
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
import rabbitpy
|
|
111
|
+
|
|
112
|
+
with rabbitpy.Connection('amqp://guest:guest@localhost:5672/%2f') as conn:
|
|
113
|
+
with conn.channel() as channel:
|
|
114
|
+
tx = rabbitpy.Tx(channel)
|
|
115
|
+
tx.select()
|
|
116
|
+
message = rabbitpy.Message(channel, 'Hello, world!')
|
|
117
|
+
message.publish('', routing_key='my-queue')
|
|
118
|
+
tx.commit()
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Simple one-liner API
|
|
122
|
+
|
|
123
|
+
For scripts and simple use cases, rabbitpy provides module-level functions
|
|
124
|
+
that manage the connection and channel for you:
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
import rabbitpy
|
|
128
|
+
|
|
129
|
+
# Publish
|
|
130
|
+
rabbitpy.publish('amqp://localhost/%2f', routing_key='my-queue', body=b'hello')
|
|
131
|
+
|
|
132
|
+
# Get
|
|
133
|
+
message = rabbitpy.get('amqp://localhost/%2f', queue_name='my-queue')
|
|
134
|
+
|
|
135
|
+
# Consume
|
|
136
|
+
for message in rabbitpy.consume('amqp://localhost/%2f', queue_name='my-queue'):
|
|
137
|
+
print(message.body)
|
|
138
|
+
message.ack()
|
|
139
|
+
break
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Connection URL
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
amqp[s]://username:password@host:port/virtual_host[?options]
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Query string options:
|
|
149
|
+
|
|
150
|
+
| Option | Description |
|
|
151
|
+
|---|---|
|
|
152
|
+
| `heartbeat` | Heartbeat interval in seconds (default: 60) |
|
|
153
|
+
| `channel_max` | Maximum number of channels |
|
|
154
|
+
| `frame_max` | Maximum frame size in bytes |
|
|
155
|
+
| `timeout` | Connection timeout in seconds (default: 3) |
|
|
156
|
+
| `cacertfile` | Path to CA certificate file |
|
|
157
|
+
| `certfile` | Path to client certificate file |
|
|
158
|
+
| `keyfile` | Path to client certificate key |
|
|
159
|
+
| `verify` | Certificate verification: `ignore`, `optional`, or `required` |
|
|
160
|
+
|
|
161
|
+
Example: `amqp://guest:guest@localhost:5672/%2f?heartbeat=30&timeout=5`
|
|
162
|
+
|
|
163
|
+
## Documentation
|
|
164
|
+
|
|
165
|
+
Full API documentation is available at [https://gmr.github.io/rabbitpy/](https://gmr.github.io/rabbitpy/).
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
BSD 3-Clause. See [LICENSE](LICENSE) for details.
|
rabbitpy-3.0.2/README.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# rabbitpy
|
|
2
|
+
|
|
3
|
+
A pure-Python, thread-safe, minimalistic RabbitMQ client library.
|
|
4
|
+
|
|
5
|
+
rabbitpy provides a straightforward API for working with RabbitMQ. Connections,
|
|
6
|
+
channels, queues, exchanges, and messages are plain Python objects. The library
|
|
7
|
+
handles the AMQP protocol details so you don't have to.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install rabbitpy
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
- Python 3.11+
|
|
18
|
+
- RabbitMQ 3.8+
|
|
19
|
+
|
|
20
|
+
## Quick start
|
|
21
|
+
|
|
22
|
+
### Publish a message
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
import rabbitpy
|
|
26
|
+
|
|
27
|
+
with rabbitpy.Connection('amqp://guest:guest@localhost:5672/%2f') as conn:
|
|
28
|
+
with conn.channel() as channel:
|
|
29
|
+
exchange = rabbitpy.Exchange(channel, 'my-exchange')
|
|
30
|
+
exchange.declare()
|
|
31
|
+
|
|
32
|
+
queue = rabbitpy.Queue(channel, 'my-queue')
|
|
33
|
+
queue.declare()
|
|
34
|
+
queue.bind(exchange, 'my-routing-key')
|
|
35
|
+
|
|
36
|
+
message = rabbitpy.Message(channel, 'Hello, world!')
|
|
37
|
+
message.publish(exchange, 'my-routing-key')
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Consume messages
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
import rabbitpy
|
|
44
|
+
|
|
45
|
+
with rabbitpy.Connection('amqp://guest:guest@localhost:5672/%2f') as conn:
|
|
46
|
+
with conn.channel() as channel:
|
|
47
|
+
for message in rabbitpy.Queue(channel, 'my-queue'):
|
|
48
|
+
print(message.body)
|
|
49
|
+
message.ack()
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Get a single message
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import rabbitpy
|
|
56
|
+
|
|
57
|
+
with rabbitpy.Connection('amqp://guest:guest@localhost:5672/%2f') as conn:
|
|
58
|
+
with conn.channel() as channel:
|
|
59
|
+
queue = rabbitpy.Queue(channel, 'my-queue')
|
|
60
|
+
message = queue.get()
|
|
61
|
+
if message:
|
|
62
|
+
print(message.body)
|
|
63
|
+
message.ack()
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Publish with confirmations
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
import rabbitpy
|
|
70
|
+
|
|
71
|
+
with rabbitpy.Connection('amqp://guest:guest@localhost:5672/%2f') as conn:
|
|
72
|
+
with conn.channel() as channel:
|
|
73
|
+
channel.enable_publisher_confirms()
|
|
74
|
+
message = rabbitpy.Message(channel, 'Hello, world!')
|
|
75
|
+
if message.publish('', routing_key='my-queue'):
|
|
76
|
+
print('Confirmed by broker')
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Transactional publishing
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
import rabbitpy
|
|
83
|
+
|
|
84
|
+
with rabbitpy.Connection('amqp://guest:guest@localhost:5672/%2f') as conn:
|
|
85
|
+
with conn.channel() as channel:
|
|
86
|
+
tx = rabbitpy.Tx(channel)
|
|
87
|
+
tx.select()
|
|
88
|
+
message = rabbitpy.Message(channel, 'Hello, world!')
|
|
89
|
+
message.publish('', routing_key='my-queue')
|
|
90
|
+
tx.commit()
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Simple one-liner API
|
|
94
|
+
|
|
95
|
+
For scripts and simple use cases, rabbitpy provides module-level functions
|
|
96
|
+
that manage the connection and channel for you:
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
import rabbitpy
|
|
100
|
+
|
|
101
|
+
# Publish
|
|
102
|
+
rabbitpy.publish('amqp://localhost/%2f', routing_key='my-queue', body=b'hello')
|
|
103
|
+
|
|
104
|
+
# Get
|
|
105
|
+
message = rabbitpy.get('amqp://localhost/%2f', queue_name='my-queue')
|
|
106
|
+
|
|
107
|
+
# Consume
|
|
108
|
+
for message in rabbitpy.consume('amqp://localhost/%2f', queue_name='my-queue'):
|
|
109
|
+
print(message.body)
|
|
110
|
+
message.ack()
|
|
111
|
+
break
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Connection URL
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
amqp[s]://username:password@host:port/virtual_host[?options]
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Query string options:
|
|
121
|
+
|
|
122
|
+
| Option | Description |
|
|
123
|
+
|---|---|
|
|
124
|
+
| `heartbeat` | Heartbeat interval in seconds (default: 60) |
|
|
125
|
+
| `channel_max` | Maximum number of channels |
|
|
126
|
+
| `frame_max` | Maximum frame size in bytes |
|
|
127
|
+
| `timeout` | Connection timeout in seconds (default: 3) |
|
|
128
|
+
| `cacertfile` | Path to CA certificate file |
|
|
129
|
+
| `certfile` | Path to client certificate file |
|
|
130
|
+
| `keyfile` | Path to client certificate key |
|
|
131
|
+
| `verify` | Certificate verification: `ignore`, `optional`, or `required` |
|
|
132
|
+
|
|
133
|
+
Example: `amqp://guest:guest@localhost:5672/%2f?heartbeat=30&timeout=5`
|
|
134
|
+
|
|
135
|
+
## Documentation
|
|
136
|
+
|
|
137
|
+
Full API documentation is available at [https://gmr.github.io/rabbitpy/](https://gmr.github.io/rabbitpy/).
|
|
138
|
+
|
|
139
|
+
## License
|
|
140
|
+
|
|
141
|
+
BSD 3-Clause. See [LICENSE](LICENSE) for details.
|
|
@@ -4,9 +4,9 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "rabbitpy"
|
|
7
|
-
version = "3.0.
|
|
7
|
+
version = "3.0.2"
|
|
8
8
|
description = "A pure python, thread-safe, minimalistic and pythonic RabbitMQ client library"
|
|
9
|
-
readme = "README.
|
|
9
|
+
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
11
11
|
license = "BSD-3-Clause"
|
|
12
12
|
license-files = ["LICENSE"]
|
|
@@ -249,7 +249,10 @@ class IO(threading.Thread):
|
|
|
249
249
|
sock = socket.socket(address_family, sock_type, protocol)
|
|
250
250
|
context = self._get_ssl_context()
|
|
251
251
|
if context:
|
|
252
|
-
return context.wrap_socket(
|
|
252
|
+
return context.wrap_socket(
|
|
253
|
+
sock=sock,
|
|
254
|
+
server_hostname=self._host,
|
|
255
|
+
)
|
|
253
256
|
return sock
|
|
254
257
|
|
|
255
258
|
def _get_addr_info(self) -> AddrInfo:
|
|
@@ -370,7 +370,7 @@ class Message(base.AMQPClass):
|
|
|
370
370
|
elif not isinstance(value, str):
|
|
371
371
|
LOGGER.warning('Coercing property %s to str', key)
|
|
372
372
|
self.properties[key] = str(value)
|
|
373
|
-
elif python_type == 'int':
|
|
373
|
+
elif python_type == 'int' and not isinstance(value, int):
|
|
374
374
|
LOGGER.warning('Coercing property %s to int', key)
|
|
375
375
|
try:
|
|
376
376
|
self.properties[key] = int(value)
|
|
@@ -366,6 +366,12 @@ class TestNonDeliveredMessageObject(helpers.TestCase):
|
|
|
366
366
|
self.msg._coerce_properties()
|
|
367
367
|
self.assertIsInstance(self.msg.properties['priority'], int)
|
|
368
368
|
|
|
369
|
+
def test_coerce_property_int_stays_int(self):
|
|
370
|
+
self.msg.properties['priority'] = 9
|
|
371
|
+
self.msg._coerce_properties()
|
|
372
|
+
self.assertIsInstance(self.msg.properties['priority'], int)
|
|
373
|
+
self.assertEqual(self.msg.properties['priority'], 9)
|
|
374
|
+
|
|
369
375
|
def test_coerce_property_str_to_empty_dict(self):
|
|
370
376
|
self.msg.properties['headers'] = '9'
|
|
371
377
|
self.msg._coerce_properties()
|