From: Harmon Date: Sun, 11 Apr 2021 21:28:48 +0000 (-0500) Subject: Separate, update, and improve exceptions documentation X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8a831b16f1bd1288781bc924fe82397decd93b3d;p=tweepy.git Separate, update, and improve exceptions documentation Automatically use docstrings for documentation --- diff --git a/docs/api.rst b/docs/api.rst index f724d94..e28d0a4 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -281,35 +281,6 @@ Get app rate limit status .. automethod:: API.rate_limit_status -:mod:`tweepy.error` --- Exceptions -================================== - -The exceptions are available in the ``tweepy`` module directly, which means -``tweepy.error`` itself does not need to be imported. For example, -``tweepy.error.TweepError`` is available as ``tweepy.TweepError``. - - -.. exception:: TweepError - - The main exception Tweepy uses. Is raised for a number of things. - - When a ``TweepError`` is raised due to an error Twitter responded with, - the error code (`as described in the API documentation - `_) can be - accessed at ``TweepError.response.text``. Note, however, that - ``TweepError``\ s also may be raised with other things as message - (for example plain error reason strings). - - -.. exception:: RateLimitError - - Is raised when an API method fails due to hitting Twitter's rate limit. - Makes for easy handling of the rate limit specifically. - - Inherits from :exc:`TweepError`, so ``except TweepError`` will catch a - ``RateLimitError`` too. - - .. rubric:: Footnotes .. [#] https://web.archive.org/web/20170829051949/https://dev.twitter.com/rest/reference/get/search/tweets diff --git a/docs/exceptions.rst b/docs/exceptions.rst new file mode 100644 index 0000000..09bf4ff --- /dev/null +++ b/docs/exceptions.rst @@ -0,0 +1,30 @@ +.. _exceptions: + +.. currentmodule:: tweepy + +********** +Exceptions +********** + +.. autoexception:: TweepyException + +.. autoexception:: HTTPException + :show-inheritance: + +.. autoexception:: BadRequest + :show-inheritance: + +.. autoexception:: Unauthorized + :show-inheritance: + +.. autoexception:: Forbidden + :show-inheritance: + +.. autoexception:: NotFound + :show-inheritance: + +.. autoexception:: TooManyRequests + :show-inheritance: + +.. autoexception:: TwitterServerError + :show-inheritance: diff --git a/docs/index.rst b/docs/index.rst index c669799..1454693 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -19,6 +19,7 @@ Contents: extended_tweets.rst streaming_how_to.rst api.rst + exceptions.rst running_tests.rst Indices and tables