Token Manager
*************

Token Manager classes.

There should be a 1-to-1 mapping betwen an instance of a subclass of
"BaseTokenManager" and a "Reddit" instance.

A few trivial token manager classes are provided here, but it is
expected that PRAW users will create their own token manager classes
suitable for their needs.

See ref:*using_refresh_tokens* for examples on how to leverage these
classes.

class praw.util.token_manager.BaseTokenManager

   An abstract class for all token managers.

   __init__()

      Prepare attributes needed by all token manager classes.

   post_refresh_callback(authorizer)

      Handle callback that is invoked after a refresh token is used.

      Parameters:
         **authorizer** – The "prawcore.Authorizer" instance used
         containing "access_token" and "refresh_token" attributes.

      This function will be called after refreshing the access and
      refresh tokens. This callback can be used for saving the updated
      "refresh_token".

   pre_refresh_callback(authorizer)

      Handle callback that is invoked before refreshing PRAW’s
      authorization.

      Parameters:
         **authorizer** – The "prawcore.Authorizer" instance used
         containing "access_token" and "refresh_token" attributes.

      This callback can be used to inspect and modify the attributes
      of the "prawcore.Authorizer" instance, such as setting the
      "refresh_token".

   property reddit

      Return the "Reddit" instance bound to the token manager.

class praw.util.token_manager.FileTokenManager(filename)

   Provides a trivial single-file based token manager.

   __init__(filename)

      Load and save refresh tokens from a file.

      Parameters:
         **filename** – The file the contains the refresh token.

   post_refresh_callback(authorizer)

      Update the saved copy of the refresh token.

   pre_refresh_callback(authorizer)

      Load the refresh token from the file.

   property reddit

      Return the "Reddit" instance bound to the token manager.
