# Path: oscar_mws/api.py
# class MWSError(Exception):
#     """
#     Main MWS Exception class
#     """
#     # Allows quick access to the response object.
#     # Do not rely on this attribute, always check if its not None.
#     response = None
#     url = None
# 
# Path: oscar_mws/connection.py
# def get_merchant_connection(merchant_id, api_name):
#     global _mws_connections
# 
#     if merchant_id in _mws_connections:
#         return _mws_connections[merchant_id].get_api_class(api_name)
# 
#     try:
#         connection = Connection(merchant_id)
#     except ImproperlyConfigured as exc:
#         logger.error(exc.message)
#         return None
# 
#     _mws_connections[merchant_id] = connection
#     return _mws_connections[merchant_id].get_api_class(api_name)


import logging
from django.db.models import get_model
from ..api import MWSError
from ..connection import get_merchant_connection



logger = logging.getLogger('oscar_mws')

AmazonMarketplace = get_model('oscar_mws', 'AmazonMarketplace')


def update_marketplaces(merchant):
    sellers_api = get_merchant_connection(merchant.seller_id, 'sellers')


# Path: oscar_mws/api.py
# class MWSError(Exception):
#     """
#     Main MWS Exception class
#     """
#     # Allows quick access to the response object.
#     # Do not rely on this attribute, always check if its not None.
#     response = None
#     url = None
# 
# Path: oscar_mws/connection.py
# def get_merchant_connection(merchant_id, api_name):
#     global _mws_connections
# 
#     if merchant_id in _mws_connections:
#         return _mws_connections[merchant_id].get_api_class(api_name)
# 
#     try:
#         connection = Connection(merchant_id)
#     except ImproperlyConfigured as exc:
#         logger.error(exc.message)
#         return None
# 
#     _mws_connections[merchant_id] = connection
#     return _mws_connections[merchant_id].get_api_class(api_name)


# Path: oscar_mws/seller/gateway.py
import logging
from django.db.models import get_model
from ..api import MWSError
from ..connection import get_merchant_connection




logger = logging.getLogger('oscar_mws')

AmazonMarketplace = get_model('oscar_mws', 'AmazonMarketplace')


def update_marketplaces(merchant):
    sellers_api = get_merchant_connection(merchant.seller_id, 'sellers')


    try: