示例#1
0
 def password(self):
     """The password used to sign in to the Google Mail account (a string)."""
     return get_secret(
         options=self.config,
         value_option="password",
         name_option="password-name",
         description="Google account password",
     )
示例#2
0
 def get_password(self):
     """Feed the configured :attr:`password` to :mod:`hangups`."""
     if not password:
         password=get_secret(
             options=self.config,
             value_option="password",
             name_option="password-name",
             description="Google account password",
         )
     return self.password
示例#3
0
    def api_hash(self):
        """
        The API hash used to connect to the Telegram API (a string).

        The value of this property can be configured as follows:

        .. code-block:: ini

           [telegram]
           api-hash = ...

        You can use the ``api-hash-name`` configuration file option to specify
        the name of a secret in ``~/.password-store`` instead.
        """
        return get_secret(options=self.config,
                          value_option="api-hash",
                          name_option="api-hash-name",
                          description="Telegram API hash")
示例#4
0
    def api_id(self):
        """
        The API ID used to connect to the Telegram API (an integer).

        The value of this property can be configured as follows:

        .. code-block:: ini

           [telegram]
           api-id = ...

        You can use the ``api-id-name`` configuration file option to specify
        the name of a secret in ``~/.password-store`` instead.
        """
        return int(
            get_secret(options=self.config,
                       value_option="api-id",
                       name_option="api-id-name",
                       description="Telegram API ID"))
    def client(self):
        """The hangups client object."""
        # Make sure the directory with cached credentials exists.
        ensure_directory_exists(os.path.dirname(self.cookie_file))

        dirs = appdirs.AppDirs('hangups', 'hangups')
        token_path = os.path.join(dirs.user_cache_dir, 'refresh_token.txt')

        return Client(
            get_auth(
                GoogleAccountCredentials(
                    email_address=self.config["email-address"],
                    password=get_secret(
                        options=self.config,
                        value_option="password",
                        name_option="password-name",
                        description="Google account password",
                    ),
                ),
                RefreshTokenCache(token_path),
            ))
示例#6
0
 def api_token(self):
     """The Slack API token (a string)."""
     return get_secret(options=self.config,
                       value_option="api-token",
                       name_option="api-token-name",
                       description="Slack API token")