From 621f1e92e1d3ce3c660c6cb4baa2cc0417153525 Mon Sep 17 00:00:00 2001 From: Menno Smits Date: Wed, 17 Aug 2016 22:59:43 +1200 Subject: [PATCH] Document the livetest/interact INI file format Closes #193. --HG-- branch : stable --- README.rst | 9 ++++---- doc/src/index.rst | 52 ++++++++++++++++++++++++++++++++++++++++++-- doc/src/releases.rst | 4 ++++ 3 files changed, 59 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index b9ff8ba..8f2b866 100644 --- a/README.rst +++ b/README.rst @@ -17,7 +17,7 @@ Features: - Convenience methods are provided for commonly used functionality. - Exceptions are raised when errors occur. -Python versions 2.6, 2.7, 3.3 and 3.4 are officially supported. +Python versions 2.6, 2.7, 3.3, 3.4 and 3.5 are officially supported. The current stable version of IMAPClient is 1.0.1. It is licensed under the New BSD License. @@ -159,12 +159,13 @@ compatibility with a given IMAP server implementation. The livetest functionality can also be accessed like this:: - python -m imapclient.livetest ... + python -m imapclient.livetest [ optional unittest arguments ] Alternatively you can run the ``livetest.py`` script included with the -source distribution. +source distribution. Use ``livetest.py --help`` to see usage. -Use the --help option to see usage. +The configuration file format is +`described in the main documentation `_. **WARNING**: The operations used by livetest are destructive and could cause unintended loss of data. That said, as of version 0.9, livetest diff --git a/doc/src/index.rst b/doc/src/index.rst index 7646a75..a84bf42 100644 --- a/doc/src/index.rst +++ b/doc/src/index.rst @@ -273,12 +273,18 @@ Various options are available to specify the IMAP server details. See the help (--help) for more details. You'll be prompted for a username and password if one isn't provided on the command line. -The connected IMAPClient instance is available as the variable "c". +It is also possible to pass connection details as a configuration file +like this:: + + python -m imapclient.interact -f + +See below for details of the :ref:`configuration file format`. If installed, IPython will be used as the embedded shell. Otherwise the basic built-in Python shell will be used. -Here's an example session:: +The connected IMAPClient instance is available as the variable +"c". Here's an example session:: $ python -m imapclient.interact -H -u ... Connecting... @@ -309,6 +315,48 @@ Here's an example session:: In [3]: c.logout() Out[3]: b'Logging out' +.. _conf-files: + +Configuration File Format +------------------------- +Both the IMAPClient interactive shell and the live tests take +configuration files which specify how to to connect to an IMAP +server. The configuration file format is the same for both. + +Configuration files use the INI format and must always have a section +called ``DEFAULT``. Here's a simple example:: + + [DEFAULT] + host = imap.mailserver.com + username = bob + password = sekret + ssl = True + +The supported options are: + +==================== ======= ========================================================================================= +Name Type Description +==================== ======= ========================================================================================= +host string IMAP hostname to connect to. +username string The username to authenticate as. +password string The password to use with ``username``. +port int Server port to connect to. Defaults to 143 unless ``ssl`` is True. +ssl bool Use SSL/TLS to connect. +starttls bool Use STARTTLS to connect. +ssl_check_hostname bool If true and SSL is in use, check that certificate matches the hostname (defaults to true) +ssl_verify_cert bool If true and SSL is in use, check that the certifcate is valid (defaults to true). +ssl_ca_file string If SSL is true, use this to specify certificate authority certs to validate with. +timeout int Time out I/O operations after this many seconds. +oauth2 bool If true, use OAUTH2 to authenticate (``username`` and ``password`` are ignored). +oauth2_client_id string OAUTH2 client id. +oauth2_client_secret string OAUTH2 client secret. +oauth2_refresh_token string OAUTH2 token for refreshing the secret. +==================== ======= ========================================================================================= + +Acceptable boolean values are "1", "yes", "true", and "on", for true; +and "0", "no", "false", and "off", for false. + + External Documentation ---------------------- The `Unofficial IMAP Protocol Wiki `_ is diff --git a/doc/src/releases.rst b/doc/src/releases.rst index 8850c01..fb8022a 100644 --- a/doc/src/releases.rst +++ b/doc/src/releases.rst @@ -4,6 +4,10 @@ Version 1.0.2 =============== +New +--- +- Documented the livetest/interact INI file format. + Changed ------- - Explicitly check that the required pyOpenSSL version is installed -- 2.43.0