blob: 15f0921130277585166a98782f274faabc86a02d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
======
Queues
======
You can get information about what messages are currently in the Mailman
queues by querying the top-level ``queues`` resource. Of course, this
information may be out-of-date by the time you receive a response, since queue
management is asynchronous, but the information will be as current as
possible.
You can get the list of all queue names.
>>> dump_json('http://localhost:9001/3.0/queues')
entry 0:
count: 0
directory: .../queue/archive
files: []
http_etag: ...
name: archive
self_link: http://localhost:9001/3.0/queues/archive
entry 1:
count: 0
directory: .../queue/bad
files: []
http_etag: ...
name: bad
self_link: http://localhost:9001/3.0/queues/bad
entry 2:
count: 0
directory: .../queue/bounces
files: []
http_etag: ...
name: bounces
self_link: http://localhost:9001/3.0/queues/bounces
entry 3:
count: 0
directory: .../queue/command
files: []
http_etag: ...
name: command
self_link: http://localhost:9001/3.0/queues/command
entry 4:
count: 0
directory: .../queue/digest
files: []
http_etag: ...
name: digest
self_link: http://localhost:9001/3.0/queues/digest
entry 5:
count: 0
directory: .../queue/in
files: []
http_etag: ...
name: in
self_link: http://localhost:9001/3.0/queues/in
entry 6:
count: 0
directory: .../queue/nntp
files: []
http_etag: ...
name: nntp
self_link: http://localhost:9001/3.0/queues/nntp
entry 7:
count: 0
directory: .../queue/out
files: []
http_etag: ...
name: out
self_link: http://localhost:9001/3.0/queues/out
entry 8:
count: 0
directory: .../queue/pipeline
files: []
http_etag: ...
name: pipeline
self_link: http://localhost:9001/3.0/queues/pipeline
entry 9:
count: 0
directory: .../queue/retry
files: []
http_etag: ...
name: retry
self_link: http://localhost:9001/3.0/queues/retry
entry 10:
count: 0
directory: .../queue/shunt
files: []
http_etag: ...
name: shunt
self_link: http://localhost:9001/3.0/queues/shunt
entry 11:
count: 0
directory: .../queue/virgin
files: []
http_etag: ...
name: virgin
self_link: http://localhost:9001/3.0/queues/virgin
http_etag: ...
self_link: http://localhost:9001/3.0/queues
start: 0
total_size: 12
Query an individual queue to get a count of, and the list of file base names
in the queue. There are currently no files in the ``bad`` queue.
>>> dump_json('http://localhost:9001/3.0/queues/bad')
count: 0
directory: .../queue/bad
files: []
http_etag: ...
name: bad
self_link: http://localhost:9001/3.0/queues/bad
We can inject a message into the ``bad`` queue. It must be destined for an
existing mailing list.
>>> dump_json('http://localhost:9001/3.0/lists', {
... 'fqdn_listname': 'ant@example.com',
... })
content-length: 0
content-type: application/json; charset=UTF-8
date: ...
location: http://localhost:9001/3.0/lists/ant.example.com
server: WSGIServer/0.2 CPython/...
status: 201
While list creation takes an FQDN list name, injecting a message to the queue
requires a List ID.
>>> dump_json('http://localhost:9001/3.0/queues/bad', {
... 'list_id': 'ant.example.com',
... 'text': """\
... From: anne@example.com
... To: ant@example.com
... Subject: Testing
...
... """})
content-length: 0
content-type: application/json; charset=UTF-8
date: ...
location: http://localhost:9001/3.0/queues/bad/...
server: ...
status: 201
And now the ``bad`` queue has at least one message in it.
>>> dump_json('http://localhost:9001/3.0/queues/bad')
count: 1
directory: .../queue/bad
files: ['...']
http_etag: ...
name: bad
self_link: http://localhost:9001/3.0/queues/bad
We can delete the injected message.
>>> json = call_http('http://localhost:9001/3.0/queues/bad')
>>> len(json['files'])
1
>>> dump_json('http://localhost:9001/3.0/queues/bad/{}'.format(
... json['files'][0]),
... method='DELETE')
content-length: 0
date: ...
server: ...
status: 204
And now the queue has no files.
>>> dump_json('http://localhost:9001/3.0/queues/bad')
count: 0
directory: .../queue/bad
files: []
http_etag: ...
name: bad
self_link: http://localhost:9001/3.0/queues/bad
|