Exceptions & Error Handling#

Exceptions and error handling for stravalib. These are classes designed to capture and handle various errors encountered when interacting with the Strava API.

exception stravalib.exc.AccessUnauthorized(*args: Any, **kwargs: Any)[source]#

Bases: Fault

When we get a 401 back from an API call.

add_note()#

Exception.add_note(note) – add a note to the exception

args#
characters_written#
errno#

POSIX exception code

filename#

exception filename

filename2#

second exception filename

request#
response#
strerror#

exception strerror

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception stravalib.exc.ActivityPhotoUploadFailed[source]#

Bases: RuntimeError

add_note()#

Exception.add_note(note) – add a note to the exception

args#
with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception stravalib.exc.ActivityPhotoUploadNotSupported[source]#

Bases: ActivityPhotoUploadFailed

add_note()#

Exception.add_note(note) – add a note to the exception

args#
with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception stravalib.exc.ActivityUploadFailed[source]#

Bases: RuntimeError

add_note()#

Exception.add_note(note) – add a note to the exception

args#
with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception stravalib.exc.ApplicationInactive(*args: Any, **kwargs: Any)[source]#

Bases: Fault

When we get a 403 back because the Strava application is inactive.

Strava sets an application to inactive when the account that owns it has no active Strava subscription. All API calls then fail with a 403 response. The owner has to subscribe and reactivate the application at https://www.strava.com/settings/api.

add_note()#

Exception.add_note(note) – add a note to the exception

args#
characters_written#
errno#

POSIX exception code

filename#

exception filename

filename2#

second exception filename

request#
response#
strerror#

exception strerror

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception stravalib.exc.AuthError[source]#

Bases: RuntimeError

add_note()#

Exception.add_note(note) – add a note to the exception

args#
with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception stravalib.exc.CreatedActivityDeleted[source]#

Bases: ActivityUploadFailed

add_note()#

Exception.add_note(note) – add a note to the exception

args#
with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception stravalib.exc.ErrorProcessingActivity[source]#

Bases: ActivityUploadFailed

add_note()#

Exception.add_note(note) – add a note to the exception

args#
with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception stravalib.exc.Fault(*args: Any, **kwargs: Any)[source]#

Bases: HTTPError

Container for exceptions raised by the remote server.

add_note()#

Exception.add_note(note) – add a note to the exception

args#
characters_written#
errno#

POSIX exception code

filename#

exception filename

filename2#

second exception filename

request#
response#
strerror#

exception strerror

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception stravalib.exc.LoginFailed[source]#

Bases: AuthError

add_note()#

Exception.add_note(note) – add a note to the exception

args#
with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception stravalib.exc.LoginRequired[source]#

Bases: AuthError

Login is required to perform specified action.

add_note()#

Exception.add_note(note) – add a note to the exception

args#
with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception stravalib.exc.NotAuthenticatedAthlete[source]#

Bases: AuthError

Exception when trying to access data which requires an authenticated athlete

add_note()#

Exception.add_note(note) – add a note to the exception

args#
with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception stravalib.exc.ObjectNotFound(*args: Any, **kwargs: Any)[source]#

Bases: Fault

When we get a 404 back from an API call.

add_note()#

Exception.add_note(note) – add a note to the exception

args#
characters_written#
errno#

POSIX exception code

filename#

exception filename

filename2#

second exception filename

request#
response#
strerror#

exception strerror

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception stravalib.exc.RateLimitExceeded(msg: str, timeout: float | None = None, limit: float | None = None)[source]#

Bases: RuntimeError

Exception raised when the client rate limit has been exceeded.

https://developers.strava.com/docs/rate-limits/

add_note()#

Exception.add_note(note) – add a note to the exception

args#
with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception stravalib.exc.RateLimitTimeout(msg: str, timeout: float | None = None, limit: float | None = None)[source]#

Bases: RateLimitExceeded

Exception raised when the client rate limit has been exceeded and the time to clear the limit (timeout) has not yet been reached

https://developers.strava.com/docs/rate-limits/

add_note()#

Exception.add_note(note) – add a note to the exception

args#
with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception stravalib.exc.TimeoutExceeded[source]#

Bases: RuntimeError

add_note()#

Exception.add_note(note) – add a note to the exception

args#
with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception stravalib.exc.UnboundEntity[source]#

Bases: RuntimeError

Exception used to indicate that a model Entity is not bound to client instances.

add_note()#

Exception.add_note(note) – add a note to the exception

args#
with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

stravalib.exc.warn_attribute_unofficial(attr_name: str) → None[source]#
stravalib.exc.warn_method_deprecation(klass: type, method_name: str, alternative: str, alt_url: str | None = None) → None[source]#
stravalib.exc.warn_method_restricted(method_name: str, restriction_date: str, alt_url: str | None = None) → None[source]#

Warn that Strava limited the endpoint used by a method to a higher tier.

Parameters:
  • method_name (str) – Name of the method that calls the endpoint.

  • restriction_date (str) – Date on which Strava applied the restriction.

  • alt_url (str, optional) – Link to more information about the change.

stravalib.exc.warn_method_unofficial(method_name: str) → None[source]#
stravalib.exc.warn_param_deprecation(param_name: str, alternative: str, alt_url: str | None = None) → None[source]#
stravalib.exc.warn_param_unofficial(param_name: str) → None[source]#
stravalib.exc.warn_param_unsupported(param_name: str) → None[source]#
stravalib.exc.warn_units_deprecated() → None[source]#