$ hug -f dns_proxy/__init__.py
Traceback (most recent call last):
File "/home/xengi/.pyvenvs//dns-proxy/bin/hug", line 33, in <module>
sys.exit(load_entry_point('hug', 'console_scripts', 'hug')())
File "/home/xengi/.pyvenvs/dns-proxy/lib/python3.8/site-packages/hug/interface.py", line 650, in __call__
raise exception
File "/home/xengi/.pyvenvs/dns-proxy/lib/python3.8/site-packages/hug/interface.py", line 646, in __call__
result = self.output(self.interface(**pass_to_function), context)
File "/home/xengi/.pyvenvs/dns-proxy/lib/python3.8/site-packages/hug/interface.py", line 129, in __call__
return __hug_internal_self._function(*args, **kwargs)
File "/home/xengi/.pyvenvs/dns-proxy/lib/python3.8/site-packages/hug/development_runner.py", line 65, in hug
api_module = importlib.machinery.SourceFileLoader(file.split(".")[0], file).load_module()
File "<frozen importlib._bootstrap_external>", line 462, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 962, in load_module
File "<frozen importlib._bootstrap_external>", line 787, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 702, in _load
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "dns_proxy/__init__.py", line 10, in <module>
import hug_authentication_ldap
File "/home/xengi/.pyvenvs/dns-proxy/lib/python3.8/site-packages/hug_authentication_ldap/__init__.py", line 23, in <module>
from hug_authentication_ldap.authentication import server, verify, basic
File "/home/xengi/.pyvenvs/dns-proxy/lib/python3.8/site-packages/hug_authentication_ldap/authentication.py", line 35, in <module>
def verify(server_instance, user_template="uid={user_name},ou=people", authentication=ldap3.AUTH_SIMPLE, auto_bind=True,
AttributeError: module 'ldap3' has no attribute 'AUTH_SIMPLE'
import hug
import hug_authentication_ldap
authentication = hug_authentication_ldap.basic('ldaps://myldapserver.com:7636', 'uid={user_name},cn=users,dc=my,dc=domain,dc=com')
@hug.post('/cname/{cname}', requires=authentication)
def update_cname(cname: fqdn_type, fqdns: fqdn_list_type, user: hug.directives.user):
"""Update CNAME with list of allowed FQDNs (old list will be replaced with the given one)"""
print(user)
Getting an error when I try to use it:
Example code: