Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _save_tokens():
try:
with open(tfile, 'wb') as f:
pickle.dump(GCSFileSystem.tokens, f, 2)
except Exception as e:
warnings.warn('Saving token cache failed: ' + str(e))
def load_tokens():
"""Get "browser" tokens from disc"""
try:
with open(tfile, 'rb') as f:
tokens = pickle.load(f)
# backwards compatability
tokens = {k: (GCSFileSystem._dict_to_credentials(v)
if isinstance(v, dict) else v)
for k, v in tokens.items()}
except Exception:
tokens = {}
GCSFileSystem.tokens = tokens
def _save_tokens():
try:
with open(tfile, "wb") as f:
pickle.dump(GCSFileSystem.tokens, f, 2)
except Exception as e:
warnings.warn("Saving token cache failed: " + str(e))
def load_tokens(cls):
"""Get "browser" tokens from disc"""
try:
with open(tfile, "rb") as f:
tokens = pickle.load(f)
except Exception:
tokens = {}
GCSFileSystem.tokens = tokens