kopeechka


Namekopeechka JSON
Version 8.0 PyPI version JSON
download
home_page
SummaryThis code is a representation of the kopeechka.store API in Python
upload_time2024-03-16 09:25:05
maintainer
docs_urlNone
author
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # kopeechka

**kopeechka** - This module is a representation of the kopeechka.store API in Python

**API documentation RUS** [ https://link.kopeechka.store/CzXxp6?lang=ru&k=API]( https://link.kopeechka.store/CzXxp6?lang=ru&k=API)

**API documentation ENG** [https://link.kopeechka.store/CzXxp6?lang=en&k=API](https://link.kopeechka.store/CzXxp6?lang=en&k=API)

# Installation

Install the current version with pip:

```commandline
pip install kopeechka
```

## Usage

You can get a token in your personal account on the kopeechka.store website

```python
from kopeechka import MailActivations

api = MailActivations(api_token="TOKEN")
```

## Logger

In version 8.0 there's no longer. We've decide to delete it, because it was useless

## Exception handling

You can import KopeechkaApiError to catch errors
To catching timeout error import TimeOut

**Example:**
```python
from kopeechka import KopeechkaApiError, MailActivations, TimeOut

api = MailActivations(api_token="WRONG_TOKEN")

try:
    api.user_balance()
except KopeechkaApiError as e:
    print(e) # -> BAD_TOKEN
except TimeOut as e:
    print(e) # -> If it timed out, it return "Timed out"
```
## Types

You can import all types from kopeechka or kopeechka.kopeechka_types

## Sync methods

You can import class to work with methods from kopeechka
```python
from kopeechka import Methods

api = Methods(api_token="TOKEN")
```

## Sync example

```python
from kopeechka import MailActivations, KopeechkaApiError

api = MailActivations("TOKEN")


def main():
    try:
        ans_1 = api.user_balance()
        print(ans_1)
    except KopeechkaApiError as e:
        print(e)

    try:
        ans_2 = api.mailbox_get_email("vk.com")
        print(ans_2)
    except KopeechkaApiError as e:
        print(e)

    try:
        ans_3 = api.mailbox_get_message(ans_2.id, 1)
        print(ans_3)
    except KopeechkaApiError as e:
        print(e)

    try:
        ans_4 = api.mailbox_cancel(ans_2.id)
        print(ans_4)
    except KopeechkaApiError as e:
        print(e)

    try:
        ans_5 = api.mailbox_reorder("vk.com", ans_2.mail)
        print(ans_5)
    except KopeechkaApiError as e:
        print(e)

    try:
        ans_6 = api.mailbox_get_fresh_id("vk.com", ans_2.mail)
        print(ans_6)
    except KopeechkaApiError as e:
        print(e)

    try:
        ans_7 = api.mailbox_get_domains()
        print(ans_7)
    except KopeechkaApiError as e:
        print(e)

    try:
        ans_8 = api.mailbox_zones(1, 1)
        print(ans_8)
    except KopeechkaApiError as e:
        print(e)


if __name__ == '__main__':
    main()

```

## Async methods

You can import class to work with async methods from kopeechka
```python
from kopeechka import AsyncMethods

api = AsyncMethods(api_token="TOKEN")
```
## Async example

```python
from kopeechka import AsyncMailActivations, KopeechkaApiError
import asyncio

api = AsyncMailActivations("TOKEN")


async def main():
    try:
        ans_1 = await api.user_balance()
        print(ans_1)
    except KopeechkaApiError as e:
        print(e)

    try:
        ans_2 = await api.mailbox_get_email("vk.com")
        print(ans_2)
    except KopeechkaApiError as e:
        print(e)

    try:
        ans_3 = await api.mailbox_get_message(ans_2.id, 1)
        print(ans_3)
    except KopeechkaApiError as e:
        print(e)

    try:
        ans_4 = await api.mailbox_cancel(ans_2.id)
        print(ans_4)
    except KopeechkaApiError as e:
        print(e)

    try:
        ans_5 = await api.mailbox_reorder("vk.com", ans_2.mail)
        print(ans_5)
    except KopeechkaApiError as e:
        print(e)

    try:
        ans_6 = await api.mailbox_get_fresh_id("vk.com", ans_2.mail)
        print(ans_6)
    except KopeechkaApiError as e:
        print(e)

    try:
        ans_7 = await api.mailbox_get_domains()
        print(ans_7)
    except KopeechkaApiError as e:
        print(e)

    try:
        ans_8 = await api.mailbox_zones(1, 1)
        print(ans_8)
    except KopeechkaApiError as e:
        print(e)


if __name__ == '__main__':
    asyncio.run(main())

```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "kopeechka",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "",
    "author_email": "rem.game.on@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/78/d6/3741f5b68267132ce5fdbec077e7cc13ee97b52d2b62bdbeedd3a2e41530/kopeechka-8.0.tar.gz",
    "platform": null,
    "description": "# kopeechka\r\n\r\n**kopeechka** - This module is a representation of the kopeechka.store API in Python\r\n\r\n**API documentation RUS** [ https://link.kopeechka.store/CzXxp6?lang=ru&k=API]( https://link.kopeechka.store/CzXxp6?lang=ru&k=API)\r\n\r\n**API documentation ENG** [https://link.kopeechka.store/CzXxp6?lang=en&k=API](https://link.kopeechka.store/CzXxp6?lang=en&k=API)\r\n\r\n# Installation\r\n\r\nInstall the current version with pip:\r\n\r\n```commandline\r\npip install kopeechka\r\n```\r\n\r\n## Usage\r\n\r\nYou can get a token in your personal account on the kopeechka.store website\r\n\r\n```python\r\nfrom kopeechka import MailActivations\r\n\r\napi = MailActivations(api_token=\"TOKEN\")\r\n```\r\n\r\n## Logger\r\n\r\nIn version 8.0 there's no longer. We've decide to delete it, because it was useless\r\n\r\n## Exception handling\r\n\r\nYou can import KopeechkaApiError to catch errors\r\nTo catching timeout error import TimeOut\r\n\r\n**Example:**\r\n```python\r\nfrom kopeechka import KopeechkaApiError, MailActivations, TimeOut\r\n\r\napi = MailActivations(api_token=\"WRONG_TOKEN\")\r\n\r\ntry:\r\n    api.user_balance()\r\nexcept KopeechkaApiError as e:\r\n    print(e) # -> BAD_TOKEN\r\nexcept TimeOut as e:\r\n    print(e) # -> If it timed out, it return \"Timed out\"\r\n```\r\n## Types\r\n\r\nYou can import all types from kopeechka or kopeechka.kopeechka_types\r\n\r\n## Sync methods\r\n\r\nYou can import class to work with methods from kopeechka\r\n```python\r\nfrom kopeechka import Methods\r\n\r\napi = Methods(api_token=\"TOKEN\")\r\n```\r\n\r\n## Sync example\r\n\r\n```python\r\nfrom kopeechka import MailActivations, KopeechkaApiError\r\n\r\napi = MailActivations(\"TOKEN\")\r\n\r\n\r\ndef main():\r\n    try:\r\n        ans_1 = api.user_balance()\r\n        print(ans_1)\r\n    except KopeechkaApiError as e:\r\n        print(e)\r\n\r\n    try:\r\n        ans_2 = api.mailbox_get_email(\"vk.com\")\r\n        print(ans_2)\r\n    except KopeechkaApiError as e:\r\n        print(e)\r\n\r\n    try:\r\n        ans_3 = api.mailbox_get_message(ans_2.id, 1)\r\n        print(ans_3)\r\n    except KopeechkaApiError as e:\r\n        print(e)\r\n\r\n    try:\r\n        ans_4 = api.mailbox_cancel(ans_2.id)\r\n        print(ans_4)\r\n    except KopeechkaApiError as e:\r\n        print(e)\r\n\r\n    try:\r\n        ans_5 = api.mailbox_reorder(\"vk.com\", ans_2.mail)\r\n        print(ans_5)\r\n    except KopeechkaApiError as e:\r\n        print(e)\r\n\r\n    try:\r\n        ans_6 = api.mailbox_get_fresh_id(\"vk.com\", ans_2.mail)\r\n        print(ans_6)\r\n    except KopeechkaApiError as e:\r\n        print(e)\r\n\r\n    try:\r\n        ans_7 = api.mailbox_get_domains()\r\n        print(ans_7)\r\n    except KopeechkaApiError as e:\r\n        print(e)\r\n\r\n    try:\r\n        ans_8 = api.mailbox_zones(1, 1)\r\n        print(ans_8)\r\n    except KopeechkaApiError as e:\r\n        print(e)\r\n\r\n\r\nif __name__ == '__main__':\r\n    main()\r\n\r\n```\r\n\r\n## Async methods\r\n\r\nYou can import class to work with async methods from kopeechka\r\n```python\r\nfrom kopeechka import AsyncMethods\r\n\r\napi = AsyncMethods(api_token=\"TOKEN\")\r\n```\r\n## Async example\r\n\r\n```python\r\nfrom kopeechka import AsyncMailActivations, KopeechkaApiError\r\nimport asyncio\r\n\r\napi = AsyncMailActivations(\"TOKEN\")\r\n\r\n\r\nasync def main():\r\n    try:\r\n        ans_1 = await api.user_balance()\r\n        print(ans_1)\r\n    except KopeechkaApiError as e:\r\n        print(e)\r\n\r\n    try:\r\n        ans_2 = await api.mailbox_get_email(\"vk.com\")\r\n        print(ans_2)\r\n    except KopeechkaApiError as e:\r\n        print(e)\r\n\r\n    try:\r\n        ans_3 = await api.mailbox_get_message(ans_2.id, 1)\r\n        print(ans_3)\r\n    except KopeechkaApiError as e:\r\n        print(e)\r\n\r\n    try:\r\n        ans_4 = await api.mailbox_cancel(ans_2.id)\r\n        print(ans_4)\r\n    except KopeechkaApiError as e:\r\n        print(e)\r\n\r\n    try:\r\n        ans_5 = await api.mailbox_reorder(\"vk.com\", ans_2.mail)\r\n        print(ans_5)\r\n    except KopeechkaApiError as e:\r\n        print(e)\r\n\r\n    try:\r\n        ans_6 = await api.mailbox_get_fresh_id(\"vk.com\", ans_2.mail)\r\n        print(ans_6)\r\n    except KopeechkaApiError as e:\r\n        print(e)\r\n\r\n    try:\r\n        ans_7 = await api.mailbox_get_domains()\r\n        print(ans_7)\r\n    except KopeechkaApiError as e:\r\n        print(e)\r\n\r\n    try:\r\n        ans_8 = await api.mailbox_zones(1, 1)\r\n        print(ans_8)\r\n    except KopeechkaApiError as e:\r\n        print(e)\r\n\r\n\r\nif __name__ == '__main__':\r\n    asyncio.run(main())\r\n\r\n```\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "This code is a representation of the kopeechka.store API in Python",
    "version": "8.0",
    "project_urls": {
        "Source": "https://github.com/livvyyRUS/kopeechka"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "78d63741f5b68267132ce5fdbec077e7cc13ee97b52d2b62bdbeedd3a2e41530",
                "md5": "546b1fd2ee1c775113666bb414eed19c",
                "sha256": "351ae203a9c30fcede734246c33b44cc13fe46647d5aec6d4be49eff4baecc60"
            },
            "downloads": -1,
            "filename": "kopeechka-8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "546b1fd2ee1c775113666bb414eed19c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5403,
            "upload_time": "2024-03-16T09:25:05",
            "upload_time_iso_8601": "2024-03-16T09:25:05.953268Z",
            "url": "https://files.pythonhosted.org/packages/78/d6/3741f5b68267132ce5fdbec077e7cc13ee97b52d2b62bdbeedd3a2e41530/kopeechka-8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-16 09:25:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "livvyyRUS",
    "github_project": "kopeechka",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "kopeechka"
}
        
Elapsed time: 0.25407s