Async API Reference

Async client for Mailman Core 3.1 API.

AsyncClient provides a thin Python API over Mailman Core’s HTTP API. It is currently is very early stages and supports on read operations. Some of the read operations might be missinng as well.

To start using the client, you need an async http library. httpx is officially supported one, but making some other client work with it is pretty easy.

>>> import httpx
>>> conn = httpx.AsyncClient()
>>> from mailmanclient.asynclient import AsyncClient
>>> client = AsyncClient(conn, 'http://localhost:8001/3.1',
...                      'restadmin', 'restpass')

You will need an event loop to actually run the client. You can reuse your existing one by calling await on the client methods, or you can create a new one using the standard library asyncio module.

>>> import asyncio
>>> domains = asyncio.run(client.domains())
class mailmanclient.asynclient.AsyncClient(client: mailmanclient.restobjects.types.HTTPClientProto, base_url: str, user: str, password: str)[source]

Provide an Idiomatic API for Mailman Core.

It requires an HTTP client instance as the first argument. You can use any client which has a .request() method and accepts named parameters url, path, auth, method and data. data is supposed to be a dictionary of parameters to be passed to the HTTP request and the rest are string parameters with their usual meaning.

The parameters are based off on httpx python library.

Parameters
  • client – Http client object with an async request method.

  • base_url – Base URL to Core’s API.

  • user – Core admin username.

  • password – Core admin password.

async addresses()List[mailmanclient.asyncobjects.address.Address][source]

All the addresses in Mailman

/<api>/address

async domains()List[mailmanclient.asyncobjects.domain.Domain][source]

Get all domains.

/<api>/domains

async find_members(list_id: Optional[str] = None, subscriber: Optional[str] = None, role: Optional[str] = None, moderation_action: Optional[str] = None, delivery_status: Optional[str] = None, delivery_mode: Optional[str] = None)List[mailmanclient.asyncobjects.member.Member][source]

Find members.

/<api>/members/find

Parameters
  • list_id – Mailinglist id.

  • subscriber – Email or user_id or partial search string.

  • role – Membership role. One of ‘owner’, ‘member’, ‘nonmember’ or ‘moderator’.

  • moderation_action – One of the moderation action from ‘defer’, ‘accept’, ‘discard’, ‘reject’, ‘hold’.

  • delivery_status – Delivery status of the Member. It can be one among ‘enabled’, ‘by_user’, ‘by_moderator’ or ‘by_bounces’.

  • delivery_mode – Delivery mode of the member. It can be one between ‘plaintext_digests’, ‘mime_digests’, ‘regular’.

async lists()List[mailmanclient.asyncobjects.mailinglist.MailingList][source]

Get a list of MailingLists

/<api>/lists

async members()List[mailmanclient.asyncobjects.member.Member][source]

All the Members

/<api>/members

async system()Mapping[str, Any][source]

Get the Mailman system information.

/<api>/system

async users()List[mailmanclient.asyncobjects.user.User][source]

All the users in Mailman Core

/<api>/users

class mailmanclient.asyncobjects.domain.Domain(connection: mailmanclient.restobjects.types.ConnectionProto, data: ContentType)[source]
async delete()Tuple[mailmanclient.restobjects.types.ResponseType, ContentType]
async save()Tuple[mailmanclient.restobjects.types.ResponseType, ContentType]
class mailmanclient.asyncobjects.mailinglist.MailingList(connection: mailmanclient.restobjects.types.ConnectionProto, data: ContentType)[source]
async config()mailmanclient.asyncobjects.mailinglist.Config[source]

Get MailingList settings.

/<api>/lists/<listid>/config

async delete()Tuple[mailmanclient.restobjects.types.ResponseType, ContentType]
async get_roster(role)List[mailmanclient.asyncobjects.member.Member][source]

Get MailingList roster.

/<api>/lists/<listid>/roster/<role>

async members()List[mailmanclient.asyncobjects.member.Member][source]

Get Mailinglist members (subscribers.)

/<api>/lists/<listid>/roster/member

async moderators()List[mailmanclient.asyncobjects.member.Member][source]

Get Mailinglist moderators.

/<api>/lists/<listid>/roster/moderator

async nonmember()List[mailmanclient.asyncobjects.member.Member][source]

Get Mailinglist nonmembers.

/<api>/lists/<listid>/roster/nonmember

async owners()List[mailmanclient.asyncobjects.member.Member][source]

Get Mailinglist owners.

/<api>/lists/<listid>/roster/owner

async save()Tuple[mailmanclient.restobjects.types.ResponseType, ContentType]
class mailmanclient.asyncobjects.member.Member(connection: mailmanclient.restobjects.types.ConnectionProto, data: ContentType)[source]
async delete()Tuple[mailmanclient.restobjects.types.ResponseType, ContentType]
async preferences()
async save()Tuple[mailmanclient.restobjects.types.ResponseType, ContentType]
class mailmanclient.asyncobjects.user.User(connection: mailmanclient.restobjects.types.ConnectionProto, data: ContentType)[source]
async addresses()[source]
async delete()Tuple[mailmanclient.restobjects.types.ResponseType, ContentType]
async preferences()
async save()Tuple[mailmanclient.restobjects.types.ResponseType, ContentType]
class mailmanclient.asyncobjects.address.Address(connection: mailmanclient.restobjects.types.ConnectionProto, data: ContentType)[source]
async delete()Tuple[mailmanclient.restobjects.types.ResponseType, ContentType]
async preferences()
async save()Tuple[mailmanclient.restobjects.types.ResponseType, ContentType]
class mailmanclient.asyncobjects.preferences.Preferences(connection: mailmanclient.restobjects.types.ConnectionProto, data: ContentType)[source]
async delete()Tuple[mailmanclient.restobjects.types.ResponseType, ContentType]
async save()Tuple[mailmanclient.restobjects.types.ResponseType, ContentType]