py-mail
The project will provide the ability to receive data from the gmail mailbox in human readable type. For these purposes, there are two main functions:
get_mail_text_from_last_fewget_mail_text_by_id
1. get_mail_text_from_last_few
This function looks at each letter in the mailbox and return the letter for the specified user.
"How is this possible?" - get_mail_text_from_last_few requires a unique email address. For example:
some.address+9014@gmail.comsome.address+currnet_date()@gmail.comsome.address+datetime.now()@gmail.com
Arguments:
expected_email: expected email address who received the message ~some.address+9014@gmail.comflag: additional filter for gmail messages ~flag='Subject "Welcome to Gmail!"'timeout: time to exit the loop in sec. (end fetching data) ~timeout=60last_few: number of recent emails among which will be searched by expected_email ~last_few=5label: target label. Will be used this label if then different from MailClient ~label='inbox'
from datetime import datetime
import pytest
from py_mail import MailClient
@pytest.fixture
def mail_client():
mail_client = MailClient(email_address='some.address@gmail.com', password='AmazingPass', label='inbox')
yield mail_client
mail_client.logout()
def get_email_by_idimap_client(mail_client):
expected_email = f'some.address+{datetime.now()}@gmail.com'
mail = mail_client.get_mail_text_from_last_few(expected_email=expected_email, last_few=10, timeout=60)
return mail # or you can search some specific data from letter via regex
2. get_mail_text_by_id
This function takes the letter by index (the last one is by default) and returns its content (text). The downside is that you can get the wrong email: because of problems with long delivery or because of the large number of incoming letters
Arguments:
label- additional filter for gmail messages ~flag='Subject "Welcome to Gmail!"'flag- target label. Will be used this label if then different from MailClient ~label='inbox'index- index of required mail (bigger is newer) ~index=-1
import pytest
from py_mail import MailClient
@pytest.fixture
def mail_client():
mail_client = MailClient(email_address='some.address@gmail.com', password='AmazingPass', label='inbox')
yield mail_client
mail_client.logout()
def get_email_by_id(mail_client):
mail = mail_client.get_mail_text_by_id(label='other inbox', flag='subject "Confirm your device"')
return mail # or you can search some specific data from letter via regex
Useful Links:
Metadata
Release files for py-mail 0.0.4
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 |
|---|---|---|---|---|
| py-mail-0.0.4.tar.gz | 6.1 kB | Without provenance | Details for py-mail-0.0.4.tar.gz |
Release files / py-mail-0.0.4.tar.gz
| Download URL | py-mail-0.0.4.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2bc833214bf1840d4117db4d0b1ace4719b6b93e1a14644a564426dec61372ae
|
|
BLAKE2b-256 checksum How to use checksums |
93861e2c27631ecde650ce6ce793d92bc2e4e0a6a31884def150aa4cc0027697
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.32.1 CPython/3.7.3
|
Security for py-mail 0.0.4
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.