Decorators

lanyard.http.decorator.handle_http_error(func)[source]

Decorator for handling HTTP errors in async methods.

Works when the raise_for_status attribute is True.

Parameters:

func (Callable[[...], Awaitable[HTTPResponse]]) – An async method returning an HTTPResponse

Raises:
Returns:

A decorated function that handles HTTP errors

Return type:

Callable[[…], Coroutine[Any, Any, HTTPResponse]]