zeep - disable warning "Forcing soap:address location to HTTPS"

After a few days of research I've finally been able to solve this on my own. I didn't realize logging levels can be changed from imported modules. I added this line at the start of my code (after imports) and it fixed the issue:

import logging
logging.getLogger('zeep').setLevel(logging.ERROR)

Hope this helps other people that encounter the same problem


How about the warnings context manager?

you can do something like this, which I've used in the past

import zeep
import warnings

with warnings.catch_warnings(record=True) as w:
    warnings.simplefilter('always') 
    # this filters all warnings, and the context manager records them
    # your code is here:
    client = zeep.CachingClient('https://api.somedomain.com/Services/ApiService.svc?singleWsdl')
    client.service.VerifyLogin('user', 'pass')

    # now you want to verify you didn't ignore a different warning
    # here's an idea of how to verify:
    assert len(w) == 1, "More than one warning caught!"
    assert isinstance(w[0], WarningCategoryItShouldBe)