(self, client, cache_file)
| 41 | """ |
| 42 | |
| 43 | def __init__(self, client, cache_file): |
| 44 | self.client = client |
| 45 | default_cache_id = self.client.configuration.host.encode('utf-8') |
| 46 | try: |
| 47 | default_cachefile_name = 'osrcp-{0}.json'.format(hashlib.md5(default_cache_id, usedforsecurity=False).hexdigest()) |
| 48 | except TypeError: |
| 49 | # usedforsecurity is only supported in 3.9+ |
| 50 | default_cachefile_name = 'osrcp-{0}.json'.format(hashlib.md5(default_cache_id).hexdigest()) |
| 51 | self.__cache_file = cache_file or os.path.join(tempfile.gettempdir(), default_cachefile_name) |
| 52 | self.__init_cache() |
| 53 | |
| 54 | def __init_cache(self, refresh=False): |
| 55 | if refresh or not os.path.exists(self.__cache_file): |
no test coverage detected