Derek Stegelman

Snippet Sunday: Busting Suds Cache

This week’s snippet sunday is breaking a suds cache. When working with suds and WSDLs occasionally, suds will cache the WSDL content which will break your code when a WSDL changes. Adding this little snippet in a debug mode right before you make API calls wil clear your cache. It can also be thrown inside of a Django Management Command to be even more useful.

import os
import shutil
from tempfile import gettempdir as tmp
shutil.rmtree(os.path.join(tmp(), 'suds'), True)