class documentation
class Connection(BaseConnection): (source)
A standard Connection object.
This is an abstraction over HTTP connections for Mailmanclient. It can be
initialized with any http client library with and async request
method. The paramters are currently tailored for httpx, but if there are
folks interested in others, it is easy to provide a wrapper which accept
such parameters.
Parameters | |
client | The http client object with request method. |
Method | __init__ |
Initialize a connection to the REST API. |
Async Method | call |
Make a call to the Mailman REST API. |
Instance Variable | client |
Undocumented |
Inherited from Connection
:
Method | add |
Add a list of hooks to an existing connection object. |
Method | rewrite |
rewrite url component with self.baseurl prefix "scheme://netloc" |
Instance Variable | auth |
Undocumented |
Instance Variable | baseurl |
Undocumented |
Instance Variable | name |
Undocumented |
Instance Variable | password |
Undocumented |
Instance Variable | request |
Undocumented |
Method | _prepare |
Undocumented |
Method | _process |
Given the request parameters, pass them through the list of hooks. |
Initialize a connection to the REST API.
Parameters | |
client | Undocumented |
*args | Undocumented |
**kw | Undocumented |
baseurl | The base url to access the Mailman 3 REST API. |
name | The Basic Auth user name. If given, the password must
also be given. |
password | The Basic Auth password. If given the name must
also be given. |
request | A list of callables that can receive the request parameters and return them with some changes or unchanged. |
Make a call to the Mailman REST API.
Parameters | |
path:str | The url path to the resource. |
data:dict | Data to send, implies POST (default) or PUT. |
method:str | The HTTP method to call. Defaults to GET when data
is None or POST if data is given. |
Returns | |
None , list , dict | The response content, which will be None, a dictionary, or a list depending on the actual JSON type returned. |
Raises | |
HTTPError | when a non-2xx status code is returned. |