-WAIT_BETWEEN_REQUESTS = timedelta(0, 0.4)
-
-
-class XmlFMError(Exception): # Errors
- """
- Exception raised for errors in the input.
- """
-
- def __init__(self, expression):
- self.expression = expression
-
- def __str__(self):
- return repr(self.expression)
-
-
-class EncodingError(XmlFMError):
- """Raised when string is not unicode"""
- pass
-
-
-class XmlFMHTTPError(XmlFMError):
- """Raised when failed to connect server"""
-
- def __init__(self, expression):
- if hasattr(expression, 'code'):
- self.expression = 'error %d: %s' % (expression.code,
- expression.msg)
- else:
- self.expression = 'error: %s' % expression
-
-
-class XmlFMNotFound(XmlFMError):
- """Raised when no artist is found"""
-
- def __init__(self, message=None):
- if not message:
- message = 'Artist probably not found (http error 400)'
- self.expression = (message)
-
-
-class XmlFMMissingArtist(XmlFMError):
- """Raised when no artist name provided"""
-
- def __init__(self, message=None):
- if not message:
- message = 'Missing artist name.'
- self.expression = (message)