cisco-en-programmability / dnacentersdk

Cisco DNA Center Python SDK
https://dnacentersdk.readthedocs.io/en/latest/
MIT License
70 stars 33 forks source link

Make MyDict cachable #12

Closed steffenschumacher closed 4 years ago

steffenschumacher commented 4 years ago

Hi, I'm using flask_caching to cache certain responses from DNA Center, where the responses are MyDicts flask_cache uses Pickle for object serialisation, and would support MyDicts also with a slight modification - namely adding these overrides:

def __getstate__(self):
    return self.__dict__

def __setstate__(self, d):
    self.__dict__.update(d)

I can find no harm in doing this, and it allows me to cache the responses, so I think this should be considered into the build?

zapodeanu commented 4 years ago

Thank you for your ask. We will take this in consideration as we are in the process to update the Cisco DNA Center SDK for the latest Cisco DNA Center version.