Better reStructuredText

This commit is contained in:
Yohann D'ANELLO 2020-10-08 23:33:13 +02:00
parent 1ac8a3b757
commit 9bff8b8b62
1 changed files with 21 additions and 18 deletions

View File

@ -1,37 +1,40 @@
=========================
Python Sympa SOAP Wrapper Python Sympa SOAP Wrapper
========================= =========================
Small wrapper that uses [ZEEP](https://pypi.org/project/zeep/) to communicate with a SOAP endpoint linked to a Sympa Small wrapper that uses `ZEEP <https://pypi.org/project/zeep/>`_ to communicate with a SOAP endpoint linked to a Sympa
server, to let automation in lists creation. server, to let automation in lists creation.
Example Example
------- =======
Start by creating a new client, and log in. Start by creating a new client, and log in.
Then, you can use some pre-constructed methods. Then, you can use some pre-constructed methods.
```python .. code-block:: python
from sympasoap import Client
client = Client("https://lists.example.com/sympa") from sympasoap import Client
client.login("admin@example.com", "MY_STRONG_PASSWORD") # Get from env
# Create a list of type hotline that is named automatically-created@lists.example.com with basic description client = Client("https://lists.example.com/sympa")
client.create_list(list_name="automatically-created", subject="Automatically created list", template="hotline", client.login("admin@example.com", "MY_STRONG_PASSWORD") # Get from env
description="This mailing list was created from a Python shell.", topic="computers/software")
# Subscribe the email address toto@example.com with name "Toto TOTO" to the list automatically-created@lists.example.com # Create a list of type hotline that is named automatically-created@lists.example.com with basic description
# in non-quiet mode: the user will receive a notification that they got subscribed client.create_list(list_name="automatically-created", subject="Automatically created list", template="hotline",
client.subscribe(email="toto@example.com", list_address="automatically-created", quiet=False, name="Toto TOTO") description="This mailing list was created from a Python shell.", topic="computers/software")
# Subscribe the email address toto@example.com with name "Toto TOTO" to the list automatically-created@lists.example.com
# in non-quiet mode: the user will receive a notification that they got subscribed
client.subscribe(email="toto@example.com", list_address="automatically-created", quiet=False, name="Toto TOTO")
# Unsubscribe the email in quiet mode
client.subscribe(email="toto@example.com", list_address="automatically-created", quiet=True)
# Unsubscribe the email in quiet mode
client.subscribe(email="toto@example.com", list_address="automatically-created", quiet=True)
```
Available functions Available functions
------------------- ===================
.. code-block:: python
```python
def login(self, email: str, password: str) -> None: def login(self, email: str, password: str) -> None:
""" """
Login into the API. Set a cookie for future connexions. Login into the API. Set a cookie for future connexions.
@ -91,4 +94,4 @@ Available functions
Subscribe the user with the given email to the given mailing list. Subscribe the user with the given email to the given mailing list.
If the quiet mode is enabled, the user won't receive a notification that they got subscribed. If the quiet mode is enabled, the user won't receive a notification that they got subscribed.
""" """
```