Files
zulip/zerver/management/commands/query_ldap.py
Anders Kaseorg 11741543da python: Reformat with Black, except quotes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 13:11:19 -08:00

18 lines
513 B
Python

from argparse import ArgumentParser
from typing import Any
from django.core.management.base import BaseCommand
from zproject.backends import query_ldap
class Command(BaseCommand):
def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument('email', metavar='<email>', help="email of user to query")
def handle(self, *args: Any, **options: str) -> None:
email = options['email']
values = query_ldap(email)
for value in values:
print(value)