spotipie.exceptions

Exceptions

AccessDenied([message])

Raised when the user decides to not grant access to the app

AuthorizationException

Exceptional event happened during user authorization (including access denied by the user)

AuthorizationTimeout(timeout)

Raised when the authorization procedure started but the function waiting for a response from the user (or the Spotify server) doesn’t get any response in timeout seconds.

HttpError(response)

Error during HTTP request.

InsufficientScope(needed_scope, current_scope)

Raised when Spotipie catches that the scope of the session is not sufficient to carry out an API request before the actual request is made.

ResourceTypeMismatch(expected_type, actual_type)

Raised when the raiser expect a Spotify resource of some kind but gets another.

SpotipieException

Reference

exception spotipie.exceptions.SpotipieException[source]

Bases: Exception

exception spotipie.exceptions.HttpError(response)[source]

Bases: spotipie.exceptions.SpotipieException

Error during HTTP request. It has a response attribute.

exception spotipie.exceptions.InsufficientScope(needed_scope, current_scope)[source]

Bases: spotipie.exceptions.SpotipieException

Raised when Spotipie catches that the scope of the session is not sufficient to carry out an API request before the actual request is made.

# Important notice

Please, note that not all the errors caused by insufficient scope can be caught before a request is made: when this check is not possible and the scope is insufficient, an :class:~spotipie.errors.HttpError` is raised instead. So, make sure you include HttpError in your try-except block whenever you want to catch insufficient scope errors.

This class is here to provide you a better feedback than HttpError when this is possible.

exception spotipie.exceptions.ResourceTypeMismatch(expected_type, actual_type)[source]

Bases: spotipie.exceptions.SpotipieException

Raised when the raiser expect a Spotify resource of some kind but gets another.

Note: “type” here doesn’t refer to a Python type but to the type of a Python resource returned by Spotify API as a dictionary (contained in the “type” attribute of the dict).

exception spotipie.exceptions.AccessDenied(message='the user did not grant his/her authorization')[source]

Bases: spotipie.exceptions.AuthorizationException

Raised when the user decides to not grant access to the app

exception spotipie.exceptions.AuthorizationException[source]

Bases: spotipie.exceptions.SpotipieException

Exceptional event happened during user authorization (including access denied by the user)

exception spotipie.exceptions.AuthorizationTimeout(timeout)[source]

Bases: spotipie.exceptions.AuthorizationException

Raised when the authorization procedure started but the function waiting for a response from the user (or the Spotify server) doesn’t get any response in timeout seconds.