blob: 45ace87ece7c371e24676c5da5ea3a49ca020825 (
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
|
===========
REST server
===========
Mailman exposes a REST HTTP server for administrative control.
The server listens for connections on a configurable host name and port.
It is always protected by HTTP basic authentication using a single global
user name and password. The credentials are set in the `[webservice]` section
of the configuration using the `admin_user` and `admin_pass` properties.
Because the REST server has full administrative access, it should always be
run only on localhost, unless you really know what you're doing. In addition
you should set the user name and password to secure values and distribute them
to any REST clients with reasonable precautions.
The Mailman major and minor version numbers are in the URL.
Credentials
===========
When the `Authorization` header contains the proper credentials, the request
succeeds.
>>> from httplib2 import Http
>>> headers = {
... 'Content-Type': 'application/x-www-form-urlencode',
... 'Authorization': 'Basic cmVzdGFkbWluOnJlc3RwYXNz',
... }
>>> url = 'http://localhost:9001/3.0/system/versions'
>>> response, content = Http().request(url, 'GET', None, headers)
>>> print(response.status)
200
Version information
===================
System version information can be retrieved from the server, in the form of a
JSON encoded response.
>>> dump_json('http://localhost:9001/3.0/system/versions')
api_version: 3.0
http_etag: "..."
mailman_version: GNU Mailman 3...
python_version: ...
self_link: http://localhost:9001/3.0/system/versions
.. _REST: http://en.wikipedia.org/wiki/REST
|