# Path: mangopay/exceptions.py
# class AuthenticationError(APIError):
#     pass


import base64
import hashlib
import json
import stat
import os
import tempfile
import six
import time
import mangopay
from mangopay.exceptions import AuthenticationError
            except:
                cached = None

        return cached

    def store(self, token, env_key):
        cache_path = os.path.join(mangopay.temp_dir, "cached-data." + env_key + ".py")
        if token is None:
            return

        with open(cache_path, 'w') as f:
            os.chmod(cache_path, stat.S_IRUSR | stat.S_IWUSR)
            serialized_obj = "#" + json.dumps(token)
            f.write(serialized_obj)


class AuthorizationTokenManager(object):

    def __init__(self, handler, storage_strategy):
        self._handler = handler
        self.authorization = ApiAuthorization(handler)
        if storage_strategy:
            self.storage_strategy = storage_strategy
        else:
            self.storage_strategy = StaticStorageStrategy()

    def basic_token(self):
        return self.authorization.basic_token()

    def get_token(self):

# Path: mangopay/exceptions.py
# class AuthenticationError(APIError):
#     pass


# Path: mangopay/auth.py
import base64
import hashlib
import json
import stat
import os
import tempfile
import six
import time
import mangopay
from mangopay.exceptions import AuthenticationError

            except:
                cached = None

        return cached

    def store(self, token, env_key):
        cache_path = os.path.join(mangopay.temp_dir, "cached-data." + env_key + ".py")
        if token is None:
            return

        with open(cache_path, 'w') as f:
            os.chmod(cache_path, stat.S_IRUSR | stat.S_IWUSR)
            serialized_obj = "#" + json.dumps(token)
            f.write(serialized_obj)


class AuthorizationTokenManager(object):

    def __init__(self, handler, storage_strategy):
        self._handler = handler
        self.authorization = ApiAuthorization(handler)
        if storage_strategy:
            self.storage_strategy = storage_strategy
        else:
            self.storage_strategy = StaticStorageStrategy()

    def basic_token(self):
        return self.authorization.basic_token()

    def get_token(self):

        try: