1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-26 17:42:20 +00:00
plateforme-corres2math/corres2math/lists.py

24 lines
627 B
Python
Raw Normal View History

2020-10-09 11:49:09 +00:00
import os
_client = None
def get_sympa_client():
2020-10-09 11:49:09 +00:00
global _client
if _client is None:
if os.getenv("SYMPA_PASSWORD", None) is not None:
from sympasoap import Client
_client = Client("https://" + os.getenv("SYMPA_URL"))
_client.login(os.getenv("SYMPA_EMAIL"), os.getenv("SYMPA_PASSWORD"))
else:
_client = FakeSympaSoapClient()
2020-10-09 11:49:09 +00:00
return _client
class FakeSympaSoapClient:
"""
Simulate a Sympa Soap client to run tests, if no Sympa instance is connected.
"""
def __getattribute__(self, item):
return lambda *args, **kwargs: None