Giter Club home page Giter Club logo

Comments (6)

ecederstrand avatar ecederstrand commented on August 17, 2024

Which auth type are you using to access the Exchange server? If your username an password is correct, then it's likely that you are connecting with an auth type that the EWS service does not support.

from exchangelib.

LKleemann avatar LKleemann commented on August 17, 2024

Thank you very much for your support. Right, I had the wrong Auth type here.

chrome_5xdSAfqKhe

Here you can see the settings for authentication in the ECP. So I need NTLM.

Unfortunately, I get the following error message:

exchangelib.errors.TransportError: No valid version headers found in response (ErrorServerBusy("Reraised from ErrorInternalServerTransientError(Reraised from KeyError('www-authenticate'))"))

Can you please help me again here?

Many thanks in advance.

from exchangelib.

ecederstrand avatar ecederstrand commented on August 17, 2024

Please post the full stack trace, and the code you use to connect to the server.

from exchangelib.

LKleemann avatar LKleemann commented on August 17, 2024

Traceback

Traceback (most recent call last):
  File "/home/lkleemann/.local/lib/python3.12/site-packages/exchangelib/util.py", line 833, in post_ratelimited
    r = session.post(**kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lkleemann/.local/lib/python3.12/site-packages/requests/sessions.py", line 637, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lkleemann/.local/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lkleemann/.local/lib/python3.12/site-packages/requests/sessions.py", line 710, in send
    r = dispatch_hook("response", hooks, r, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lkleemann/.local/lib/python3.12/site-packages/requests/hooks.py", line 30, in dispatch_hook
    _hook_data = hook(hook_data, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lkleemann/.local/lib/python3.12/site-packages/requests_ntlm/requests_ntlm.py", line 168, in response_hook
    return self.retry_using_http_NTLM_auth(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lkleemann/.local/lib/python3.12/site-packages/requests_ntlm/requests_ntlm.py", line 133, in retry_using_http_NTLM_auth
    auth_header_value = response2.headers[auth_header_field]
                        ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/home/lkleemann/.local/lib/python3.12/site-packages/requests/structures.py", line 52, in __getitem__
    return self._store[key.lower()][1]
           ~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'www-authenticate'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/lkleemann/.local/lib/python3.12/site-packages/exchangelib/services/common.py", line 308, in _get_elements
    yield from self._response_generator(payload=payload)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lkleemann/.local/lib/python3.12/site-packages/exchangelib/services/common.py", line 271, in _response_generator
    response = self._get_response_xml(payload=payload)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lkleemann/.local/lib/python3.12/site-packages/exchangelib/services/common.py", line 404, in _get_response_xml
    r = self._get_response(payload=payload, api_version=api_version)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lkleemann/.local/lib/python3.12/site-packages/exchangelib/services/common.py", line 355, in _get_response
    r, session = post_ratelimited(
                 ^^^^^^^^^^^^^^^^^
  File "/home/lkleemann/.local/lib/python3.12/site-packages/exchangelib/util.py", line 852, in post_ratelimited
    raise ErrorInternalServerTransientError(f"Reraised from {e.__class__.__name__}({e})")
exchangelib.errors.ErrorInternalServerTransientError: Reraised from KeyError('www-authenticate')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/lkleemann/.local/lib/python3.12/site-packages/exchangelib/version.py", line 202, in guess
    list(ConvertId(protocol=protocol).call([AlternateId(id="DUMMY", format=EWS_ID, mailbox="DUMMY")], ENTRY_ID))
  File "/home/lkleemann/.local/lib/python3.12/site-packages/exchangelib/services/common.py", line 225, in _elems_to_objs
    for elem in elems:
  File "/home/lkleemann/.local/lib/python3.12/site-packages/exchangelib/services/common.py", line 287, in _chunked_get_elements
    yield from self._get_elements(payload=payload_func(chunk, **kwargs))
  File "/home/lkleemann/.local/lib/python3.12/site-packages/exchangelib/services/common.py", line 340, in _get_elements
    self._handle_backoff(ErrorServerBusy(f"Reraised from {e.__class__.__name__}({e})", back_off=wait))
  File "/home/lkleemann/.local/lib/python3.12/site-packages/exchangelib/services/common.py", line 446, in _handle_backoff
    raise e
exchangelib.errors.ErrorServerBusy: Reraised from ErrorInternalServerTransientError(Reraised from KeyError('www-authenticate'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/lkleemann/development/IntranetSystem/server/src/python/exchange/exchangeService.py", line 44, in <module>
    IntranetExchangeConnection = IntranetExchangeConnectionFile.IntranetExchangeConnection()
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lkleemann/development/IntranetSystem/server/src/python/exchange/functions/exchangeConnection.py", line 19, in __init__
    self.mailAccount_Intranet = Account(
                                ^^^^^^^^
  File "/home/lkleemann/.local/lib/python3.12/site-packages/exchangelib/account.py", line 205, in __init__
    self.version = self.protocol.version.copy()
                   ^^^^^^^^^^^^^^^^^^^^^
  File "/home/lkleemann/.local/lib/python3.12/site-packages/exchangelib/protocol.py", line 480, in version
    self.config.version = Version.guess(self, api_version_hint=self.api_version_hint)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lkleemann/.local/lib/python3.12/site-packages/exchangelib/version.py", line 206, in guess
    raise TransportError(f"No valid version headers found in response ({e!r})")
exchangelib.errors.TransportError: No valid version headers found in response (ErrorServerBusy("Reraised from ErrorInternalServerTransientError(Reraised from KeyError('www-authenticate'))"))

Connection to Server

self.credentials = Credentials(
            username='Test.User@[domain].de', password='[password]')
        
self.config = Configuration(server="[server]",
    credentials=self.credentials, auth_type="NTLM"
)
#  retry_policy=FaultTolerance(max_wait=3600),

self.mailAccount= Account(
    primary_smtp_address='Test.User@[domain].de', config=self.config,
    autodiscover=False, access_type=DELEGATE
)

from exchangelib.

ecederstrand avatar ecederstrand commented on August 17, 2024

This means that the server you are connecting to does not announce NTLM auth in its HTTP response headers. Either you are not connecting to the right server, or your server does not support NTLM auth after all.

from exchangelib.

LKleemann avatar LKleemann commented on August 17, 2024

Perfect, thank you very much for your support.

from exchangelib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.