{ "info": { "author": "PVladimir", "author_email": "vladimir.podolyan64@gmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 3.7" ], "description": "# py-mail\n[![Build status](https://badge.buildkite.com/fbb36b87bde2961909dc80c077614ff47acbf0e980cb1e62d6.svg?branch=master)](https://buildkite.com/pryanik/test-pymail)\n[![](https://www.codewars.com/users/PVladimir/badges/small)](https://www.codewars.com/users/PVladimir/)\n\n\nThe project will provide the ability to receive data from the gmail mailbox in human readable type.\nFor these purposes, there are two main functions:\n1. `get_mail_text_from_last_few`\n2. `get_mail_text_by_id`\n\n### 1. get_mail_text_from_last_few\nThis function looks at each letter in the mailbox and return the letter for the specified user.\n\"How is this possible?\" - `get_mail_text_from_last_few` requires a unique email address. For example:\n - `some.address+9014@gmail.com`\n - `some.address+currnet_date()@gmail.com`\n - `some.address+datetime.now()@gmail.com`\n \nArguments:\n- `expected_email`: expected email address who received the message ~ `some.address+9014@gmail.com`\n- `flag`: additional filter for gmail messages ~ `flag='Subject \"Welcome to Gmail!\"'`\n- `timeout`: time to exit the loop in sec. (end fetching data) ~ `timeout=60`\n- `last_few`: number of recent emails among which will be searched by expected_email ~ `last_few=5`\n- `label`: target label. Will be used this label if then different from MailClient ~ `label='inbox'`\n\n```python\nfrom datetime import datetime\n\nimport pytest\nfrom py_mail import MailClient\n\n@pytest.fixture\ndef mail_client():\n mail_client = MailClient(email_address='some.address@gmail.com', password='AmazingPass', label='inbox')\n yield mail_client\n mail_client.logout()\n\n\ndef get_email_by_idimap_client(mail_client):\n expected_email = f'some.address+{datetime.now()}@gmail.com'\n mail = mail_client.get_mail_text_from_last_few(expected_email=expected_email, last_few=10, timeout=60)\n return mail # or you can search some specific data from letter via regex\n```\n\n\n### 2. get_mail_text_by_id\nThis function takes the letter by index (the last one is by default) and returns its content (text).\nThe downside is that you can get the wrong email:\nbecause of problems with long delivery or because of the large number of incoming letters\n\nArguments:\n- `label` - additional filter for gmail messages ~ `flag='Subject \"Welcome to Gmail!\"'`\n- `flag` - target label. Will be used this label if then different from MailClient ~ `label='inbox'`\n- `index` - index of required mail (bigger is newer) ~ `index=-1`\n\n```python\nimport pytest\nfrom py_mail import MailClient\n\n@pytest.fixture\ndef mail_client():\n mail_client = MailClient(email_address='some.address@gmail.com', password='AmazingPass', label='inbox')\n yield mail_client\n mail_client.logout()\n\n\ndef get_email_by_id(mail_client):\n mail = mail_client.get_mail_text_by_id(label='other inbox', flag='subject \"Confirm your device\"')\n return mail # or you can search some specific data from letter via regex\n```\n\n\nUseful Links:\n- [regex](https://docs.python.org/3/library/re.html)\n- [all flags variables](https://gist.github.com/martinrusev/6121028)", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/VladimirPodolyan/py-mail", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "py-mail", "package_url": "https://pypi.org/project/py-mail/", "platform": "", "project_url": "https://pypi.org/project/py-mail/", "project_urls": { "Homepage": "https://github.com/VladimirPodolyan/py-mail" }, "release_url": "https://pypi.org/project/py-mail/0.0.4/", "requires_dist": null, "requires_python": "", "summary": "Provides data from the gmail mailbox in a human readable type", "version": "0.0.4" }, "last_serial": 5417407, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "3b765bf30db9c350543ffbad50a0a5fc", "sha256": "45313ad5d433bf9afcc269a62fd26177a45b15bc9e2f92a06fbfce10fb2ce01b" }, "downloads": -1, "filename": "py-mail-0.0.1.tar.gz", "has_sig": false, "md5_digest": "3b765bf30db9c350543ffbad50a0a5fc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 887, "upload_time": "2019-06-18T19:20:14", "url": "https://files.pythonhosted.org/packages/59/c7/0922ed101f8034c3ddb6d2b67b7c63126ff8b77a76d2a1234c100ee31689/py-mail-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "a6013d3728e0e4823399e0c8ef3c38e3", "sha256": "c6c8999b36d61df4a42497aa4bbbad49f164ef0cc49fcd824492197dfd126082" }, "downloads": -1, "filename": "py-mail-0.0.2.tar.gz", "has_sig": false, "md5_digest": "a6013d3728e0e4823399e0c8ef3c38e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4944, "upload_time": "2019-06-18T20:11:38", "url": "https://files.pythonhosted.org/packages/a4/a3/35fc5a1469182d1f14d99ee1be600b8bd3d94d4a1efcd494bd5a8ae5710d/py-mail-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "dc5fc780292a0a28cfb77c945eb621e7", "sha256": "e738f27bc2ac23e8c8674153cb8c459c71ecea6664234127b709a1c545a71436" }, "downloads": -1, "filename": "py-mail-0.0.3.tar.gz", "has_sig": false, "md5_digest": "dc5fc780292a0a28cfb77c945eb621e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4939, "upload_time": "2019-06-18T20:17:41", "url": "https://files.pythonhosted.org/packages/5a/8d/279728123df0b84335da391fcbd3bc3a5a1d3e606ec1bd4414d5fa7955e3/py-mail-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "5bcf4411198e8a37100229771c82d72b", "sha256": "2bc833214bf1840d4117db4d0b1ace4719b6b93e1a14644a564426dec61372ae" }, "downloads": -1, "filename": "py-mail-0.0.4.tar.gz", "has_sig": false, "md5_digest": "5bcf4411198e8a37100229771c82d72b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6079, "upload_time": "2019-06-18T21:35:46", "url": "https://files.pythonhosted.org/packages/93/86/1e2c27631ecde650ce6ce793d92bc2e4e0a6a31884def150aa4cc0027697/py-mail-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5bcf4411198e8a37100229771c82d72b", "sha256": "2bc833214bf1840d4117db4d0b1ace4719b6b93e1a14644a564426dec61372ae" }, "downloads": -1, "filename": "py-mail-0.0.4.tar.gz", "has_sig": false, "md5_digest": "5bcf4411198e8a37100229771c82d72b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6079, "upload_time": "2019-06-18T21:35:46", "url": "https://files.pythonhosted.org/packages/93/86/1e2c27631ecde650ce6ce793d92bc2e4e0a6a31884def150aa4cc0027697/py-mail-0.0.4.tar.gz" } ] }