gmaily
Unofficial Gmail python client with pythonic API.
Features
- Clean API
- No other dependencies than standard library
- Lazy loading for content
Example
import sys
import getpass
import datetime
from gmaily import Gmaily
g = Gmaily()
user_email = input("Email: ")
user_pw = getpass.getpass()
if not g.login(user_email, user_pw):
print("Cannot login")
sys.exit(1)
msgs = g.inbox().after(datetime.date.today() - datetime.timedelta(weeks=2))
for msg in msgs.all():
print("\n" + (" Mail UID: %d " % msg.uid).center(80, "=") + "\n")
print("Subject:", msg.subject)
print("From:", msg.sender)
print("Date:", msg.date)
print("Attachments:", msg.attachments)
print("-" * 10)
print(msg.text)
g.logout()
Usage
Searching Mailbox
SearchQuery, which is returned by some methods like Gmaily.inbox
supports method chaining and you can easily mix search criterias together:
two_weeks_ago = datetime.date.today() - datetime.timedelta(weeks=2)
msgs = g.inbox().by("john@example.com").before(two_weeks_ago)
Alternatively, you can use other mailboxes than INBOX in the above example
using Gmaily.mailbox method:
msgs = g.mailbox("URGENT").on(datetime.date.today())
You can then execute the query and fetch the results using SearchQuery.all:
print(msgs.all())
You can find the full list of supported criterias and their description at
here.
Note that ALL criteria is not present because it's the default criteria
and SearchQuery.all stands for executing the query.
Any other names like .fetch(), .do() could be taken the place,
but I chose the .all() because famous ORMs use it too.
Some other criterias are omitted too:
NOTORUID
Installation
It requires Python>=3.5.
$ pip3 install -U gmaily
License
MIT
Metadata
Release files for gmaily 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gmaily-0.0.3.tar.gz | 3.8 kB | Without provenance | Details for gmaily-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gmaily-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for gmaily-0.0.3-py3-none-any.whl |
Total release size: 7.8 kB
Release files / gmaily-0.0.3.tar.gz
| Download URL | gmaily-0.0.3.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b20d43de0bf60cdb1896c288061994c24bf4ed0193be38d9f30134415265d74d
|
|
BLAKE2b-256 checksum How to use checksums |
ee4e8995a44b268266a47e5e37b75aca9671eea1d835fdb294b9fc3da4b89507
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.8
|
Release files / gmaily-0.0.3-py3-none-any.whl
| Download URL | gmaily-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f8c9eea9015732c2a2aea775b511d059c912a56db612e20f61adbcce1331adda
|
|
BLAKE2b-256 checksum How to use checksums |
f23ab6a2890fe00987d840d95f7091886ce5086d10dc9c54c4e4f572f2df9acb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.8
|
Security for gmaily 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.