Commit Graph

256 Commits

Author SHA1 Message Date
f82ce52220 added type hints for new stuff 2018-07-27 16:00:17 -04:00
87e42a9fdd Merge branch 'vendors' of https://github.com/zevaverbach/imbox into vendors 2018-07-27 15:41:52 -04:00
86cf1fbf9b added basic structure for vendors module, including mostly blank GmailMessages class. 'vendor' is now a kwarg for Imbox, but there's also a lookup dict created in vendors/__init__.py for 'magic' determination of the vendor from the hostname.
added `authentication_error_message` as a class attribute to `Imbox`.  If `Imbox.vendor` is not None, look for a custom authentication error string, and raise it if there's a problem logging in.  The default error value is raised if there is no custom string.

created `name_authentication_string_dict` from all subclasses of `Messages` in `vendors/__init__.py`, for the lookup mentioned above.

Implement architecture discussed in #131, deciding whether to use `Messages` or a subclass of it in `Imbox.messages` based on the `Imbox.vendor` value.  Use the `folder_lookup` dict, present on `Messages` but only filled in on its subclasses, to select the right folder based on a lowercased "standard" name given as the value of `folder`.

created a blank `folder_lookup` on `Messages`.

filled in the first vendor that subclasses `Messages`, `GmailMessages`.  It contains class attributes `authentication_error_message`, `hostname`, `name`, used for purposes described above, as well as `folder_lookup` which is a dict containing aliases, sometimes several, for Gmail's unique folder naming scheme.  These aliases are meant to be "human-friendly" for intuitive `folder` selection in calls to `Imbox.messages`.

fixes #131.

prevent too much bookkeeping in vendors/__init__.py by adding each vendor.__name__ to __all__ from the vendors list.
2018-07-27 15:41:13 -04:00
6f3cc1ab92 prevent too much bookkeeping in vendors/__init__.py by adding each vendor.__name__ to __all__ from the vendors list. 2018-07-27 14:44:35 -04:00
1fbb8511b9 added authentication_error_message as a class attribute to Imbox. If Imbox.vendor is not None, look for a custom authentication error string, and raise it if there's a problem logging in. The default error value is raised if there is no custom string.
created `name_authentication_string_dict` from all subclasses of `Messages` in `vendors/__init__.py`, for the lookup mentioned above.

Implement architecture discussed in #131, deciding whether to use `Messages` or a subclass of it in `Imbox.messages` based on the `Imbox.vendor` value.  Use the `folder_lookup` dict, present on `Messages` but only filled in on its subclasses, to select the right folder based on a lowercased "standard" name given as the value of `folder`.

created a blank `folder_lookup` on `Messages`.

filled in the first vendor that subclasses `Messages`, `GmailMessages`.  It contains class attributes `authentication_error_message`, `hostname`, `name`, used for purposes described above, as well as `folder_lookup` which is a dict containing aliases, sometimes several, for Gmail's unique folder naming scheme.  These aliases are meant to be "human-friendly" for intuitive `folder` selection in calls to `Imbox.messages`.

fixes #131.
2018-07-27 14:31:21 -04:00
Martin Rusev
adf70cbed5 Update .travis.yml 2018-07-27 14:52:06 +02:00
Martin Rusev
c04c340bb7 Update .travis.yml 2018-07-27 14:34:24 +02:00
Martin Rusev
b52d43c496 Update CHANGELOG.md 2018-07-27 10:53:58 +02:00
Martin Rusev
a8440f60ca Update CHANGELOG.md 2018-07-27 10:52:21 +02:00
Martin Rusev
c86cbe766d Update README.rst 2018-07-27 10:38:07 +02:00
Martin Rusev
16a05e15e5 Merge pull request #136 from zevaverbach/stubs
Stubs!
2018-07-27 10:37:08 +02:00
7d11b590d8 added basic structure for vendors module, including mostly blank GmailMessages class. 'vendor' is now a kwarg for Imbox, but there's also a lookup dict created in vendors/__init__.py for 'magic' determination of the vendor from the hostname. 2018-07-26 15:48:31 -04:00
dfca46886f filled in stub files 2018-07-26 15:30:02 -04:00
6d527a2f1d added type hint stubs for all modules 2018-07-26 15:24:20 -04:00
80d6104387 conflict 2018-07-26 15:08:08 -04:00
Martin Rusev
0464a5a74d Merge pull request #134 from zevaverbach/126_128_130
Added flags to messages, moved classes out of __init__.py, and documented that the inbox is where Imbox.messages are from without any folder argument.
2018-07-26 21:06:51 +02:00
5b27fa1b76 removed errant dash that was causing Travis-CI to fail 2018-07-26 11:06:48 -04:00
9cffb51a81 Added missing documentation for all supported query keyword arguments. Fixes #124. Added Pycharm directory to .gitignore.
Fixed var names in documentation of query keywords

moved Messages and Imbox to their own modules, imported Imbox.imbox into __init__.py and put it in __all__. fixes #130.

clarified in documentation and Imbox.messages logging that, unless a folder is specified in the kwargs to Imbox.messages, the returned messages will be from the inbox.  In the documentation this is accomplished exclusively by the var names. fixes #128.

amended `8df7d7c` to reflect manual changes made to `README.rst` in current master, but also added `inbox_` to several var names to make that explicit in the documentation.  Added flags to messages returned by `fetch_email_by_uid`, using the new function `parse_flags` in `parser.py`.  Fixes #126.

added TODO back into query.py
2018-07-26 10:50:10 -04:00
Martin Rusev
06aa4e054b Update README.rst 2018-07-26 14:47:02 +02:00
Martin Rusev
63bddbd73c Update README.rst 2018-07-26 14:45:34 +02:00
2838639bfa conflict in .gitignore 2018-07-25 14:25:14 -04:00
Martin Rusev
34149efed5 Merge pull request #129 from zevaverbach/encapsulate_generator
Created Message class to encapsulate the "messages" generator
2018-07-25 19:46:49 +02:00
73fafcb368 made Messages methods private, as well as uid_list. 2018-07-25 12:11:59 -04:00
8e26e92a39 Moved query_ids from Imbox to Messages.
Moved `fetch_list` to `Messages` and renamed `fetch_email_list`, moving assignment of uid_list to the constructor of `Messages`.

Moved `fetch_by_uid` from `Imbox` to a pure function in `parser` module.

Replaced call to `Imbox.fetch_list` with a call to `Messages` instead.

created `Messages` class, which encapsulates the generator `Messages.fetch_email_list`, while also implementing `__len__` to show how many emails match a given query, and `__iter__` to refresh the `fetch_email_list` generator when it's exhausted.  It also implements `__getitem__` to support indexing of the emails matching a query.  Messages requires the `connection` and `parser_policy` established in `Imbox` and accepts arbitrary keyword arguments, which it uses in the IMAP query as well as in the `__repr__`.
2018-07-25 11:48:19 -04:00
635d15441e shortened up the ImapTransport constructor, a couple of similar cleanups 2018-07-25 09:00:21 -04:00
55f64a1922 removed some unused args, renamed to avoid shadowing a name in the global scope. 2018-07-25 08:46:59 -04:00
71942a69e8 fixed var names in documentation of query keywords 2018-07-25 08:27:40 -04:00
b4cb03e145 added Pycharm directory to .gitignore 2018-07-25 08:24:05 -04:00
b53a1e6837 Added missing documentation for all supported query keyword arguments. Fixes #124. 2018-07-25 08:22:50 -04:00
Martin Rusev
a1801af56e Merge pull request #119 from sblondon/factorize-version
Reuse __version__ for the library version
2018-04-05 10:21:07 +02:00
Stephane Blondon
6a0da4b105 reuse __version__ for the library version 2018-04-04 18:27:27 +02:00
Martin Rusev
5d09b6f3e4 Merge pull request #117 from sblondon/fix-encoding-in-logger
Fix encoding in logger
2018-04-04 15:43:56 +02:00
Stephane Blondon
ecb62b585c refactoring: string formatting more readable 2018-03-21 18:31:08 +01:00
Stephane Blondon
cbb46ef078 fix decoding of sender e-mail if badly encoded 2018-03-21 18:24:59 +01:00
Stephane Blondon
79ce81aa9d fix spelling error 2018-03-19 20:56:22 +01:00
Martin Rusev
96ce737df5 Merge pull request #112 from wagner-certat/version
Expose version in library
2018-01-08 12:56:01 +01:00
Sebastian Wagner
a94682fc3c Expose version in library 2018-01-08 12:07:21 +01:00
martinrusev
85abe48c8c Update version 0.9.5 2017-12-05 19:08:59 +01:00
martinrusev
9956d182eb Update changelog 2017-12-05 18:56:09 +01:00
Martin Rusev
ef68d92021 Update README.rst 2017-11-30 23:01:03 +01:00
Martin Rusev
43a37818ab Merge pull request #108 from balsagoth/feature/starttls
Add starttls support
2017-11-30 23:00:36 +01:00
Martin Rusev
7b1bda6126 Merge pull request #109 from balsagoth/feature/query_improve
add date__on to query and some other improvments
2017-11-30 23:00:27 +01:00
Ivan Pereira
fe965e7d19 add date__on to query and some other improvments 2017-11-30 21:42:16 +00:00
Ivan Pereira
cfca92df60 Update docs 2017-11-30 16:30:43 +00:00
Ivan Pereira
5664e9c48a Add suport for starttls 2017-11-30 16:14:17 +00:00
Martin Rusev
6c11c759c0 Merge pull request #107 from memanikantan/master
Query and mark emails as flagged/starred.
2017-10-29 09:46:36 +01:00
Manikantan Ramchandran
2f72aa13df typo fix 2017-10-28 17:17:49 +05:30
Manikantan Ramchandran
ffd4550524 added tests for flagged and unflagged queries 2017-10-28 17:16:44 +05:30
Manikantan Ramchandran
14c592136e added mark as flagged or starred feature 2017-10-28 16:59:11 +05:30
Manikantan Ramchandran
85025b34ff added flagged and unflagged query options 2017-10-28 16:58:05 +05:30