# Path: fnapy/exceptions.py
# class FnapyConnectionError(FnapyException):
#     """Raised when the connection is incorrect"""
# 
# Path: fnapy/utils.py
# def get_credentials(sandbox=True):
#     """Return the credentials for the sandbox or the real account
# 
#     Usage::
#         credentials = get_credentials(sandbox=sandbox)
# 
#     :type sandbox: bool
#     :param sandbox: determines whether you get the credentials for the sandbox
#     account (True) or the real account (False).
# 
#     :rtype: dict
#     :returns: the credentials for the selected account type
# 
#     """
#     credentials = {
#         "sandbox": {
#             "partner_id": os.getenv("FNAC_SANDBOX_PARTNER_ID"),
#             "shop_id": os.getenv("FNAC_SANDBOX_SHOP_ID"),
#             "key": os.getenv("FNAC_SANDBOX_KEY"),
#         },
#         "real": {
#             "partner_id": os.getenv("FNAC_PARTNER_ID"),
#             "shop_id": os.getenv("FNAC_SHOP_ID"),
#             "key": os.getenv("FNAC_KEY"),
#         },
#     }
#     use_sandbox = {True: "sandbox", False: "real"}
#     account_type = use_sandbox[sandbox]
#     return credentials[account_type]


from fnapy.exceptions import FnapyConnectionError
from fnapy.utils import get_credentials
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016  <>
#
# Distributed under terms of the MIT license.

"""
The class storing all the information for the connection to the FNAC API
"""



def check_credentials_validity(credentials):
    invalid_credentials = []
    for k, v in credentials.items():
        if v is None:
            invalid_credentials.append(k)

    if len(invalid_credentials):
        msg = "These credentials are invalid: "
        msg += ", ".join(invalid_credentials)

# Path: fnapy/exceptions.py
# class FnapyConnectionError(FnapyException):
#     """Raised when the connection is incorrect"""
# 
# Path: fnapy/utils.py
# def get_credentials(sandbox=True):
#     """Return the credentials for the sandbox or the real account
# 
#     Usage::
#         credentials = get_credentials(sandbox=sandbox)
# 
#     :type sandbox: bool
#     :param sandbox: determines whether you get the credentials for the sandbox
#     account (True) or the real account (False).
# 
#     :rtype: dict
#     :returns: the credentials for the selected account type
# 
#     """
#     credentials = {
#         "sandbox": {
#             "partner_id": os.getenv("FNAC_SANDBOX_PARTNER_ID"),
#             "shop_id": os.getenv("FNAC_SANDBOX_SHOP_ID"),
#             "key": os.getenv("FNAC_SANDBOX_KEY"),
#         },
#         "real": {
#             "partner_id": os.getenv("FNAC_PARTNER_ID"),
#             "shop_id": os.getenv("FNAC_SHOP_ID"),
#             "key": os.getenv("FNAC_KEY"),
#         },
#     }
#     use_sandbox = {True: "sandbox", False: "real"}
#     account_type = use_sandbox[sandbox]
#     return credentials[account_type]


# Path: fnapy/connection.py
from fnapy.exceptions import FnapyConnectionError
from fnapy.utils import get_credentials

#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016  <>
#
# Distributed under terms of the MIT license.

"""
The class storing all the information for the connection to the FNAC API
"""



def check_credentials_validity(credentials):
    invalid_credentials = []
    for k, v in credentials.items():
        if v is None:
            invalid_credentials.append(k)

    if len(invalid_credentials):
        msg = "These credentials are invalid: "
        msg += ", ".join(invalid_credentials)

        raise FnapyConnectionError(msg)