carma


Namecarma JSON
Version 0.0.4 PyPI version JSON
download
home_pagehttps://github.com/zeionara/karma
SummaryCli tool for managing cloud mail.ru storage
upload_time2023-12-25 22:35:05
maintainer
docs_urlNone
authorZeio Nara
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
    <img src="https://i.ibb.co/KWLVsLr/logo.png"/>
</p>

# Karma

Cli tool for managing cloud mail.ru storage

## Usage

The main feature is file upload. For example, to upload all files from local folder `~/foo/bar` to remote folder `/qux/quux/bar` use the following command:

```sh
python -m karma sync ~/foo/bar qux/quux
```

## Installation

To isntall from `pip`:

```sh
pip install carma
```

The tool is based on [cloud_mail_ru](https://github.com/kireevmp/mailru-cloud-api) package which is unofficial cloud.mail.ru's python API.

## Original docs

### All existing methods in cloud.mail.ru's API

| Implemented? | Method |         Path          |           Additional Info             |
|:------------:|:------:|:---------------------:|:-------------------------------------:|
|              | (POST) | batch                 |                                       |
|              | (POST) | clone                 |                                       |
|              | (POST) | stock/save            |                                       |
|       X      | (GET)  | dispatcher            |                                       |
|              | (POST) | docs/token            |                                       |
|       X      | (GET)  | file                  |                                       |
|       X      | (POST) | file/add              |                                       |
|       X      | (POST) | file/move             |                                       |
|       X      | (POST) | file/remove           |                                       |
|       X      | (POST) | file/rename           |                                       |
|       X      | (POST) | file/copy             |                                       |
|       X      | (POST) | file/publish          |                                       |
|       X      | (POST) | file/unpublish        |                                       |
|       X      | (GET)  | file/history          |                                       |
|       X      | (GET)  | folder                |                                       |
|       X      | (POST) | folder/add            |                                       |
|       X      | (POST) | folder/move           |`Alias for file/move`                  |
|       X      | (POST) | folder/remove         |`Alias for file/remove`                |
|       X      | (POST) | folder/rename         |`Alias for file/rename`                |
|       X      | (POST) | folder/copy           |`Alias for file/copy`                  |
|       X      | (POST) | folder/publish        |`Alias for file/publish`               |
|       X      | (POST) | folder/unpublish      |`Alias for file/unpublish`             |
|       X      | (GET)  | folder/find           |                                       |
|       X      | (GET)  | folder/invites        |                                       |
|              | (GET)  | folder/shared/links   |                                       |
|              | (GET)  | folder/invites/info   |                                       |
|              | (POST) | folder/invites/reject |                                       |
|              | (POST) | folder/mount          |                                       |
|              | (GET)  | folder/shared/incomi  |                                       |
|              | (GET)  | folder/shared/info    |                                       |
|              | (POST) | folder/share          |                                       |
|       X      | (GET)  | folder/tree           |                                       |
|              | (POST) | folder/unmount        |                                       |
|              | (POST) | folder/unshare        |                                       |
|       X      | (POST) | folder/viruscan       |                                       |
|              | (GET)  | mail/ab/contacts      |                                       |
|              | (POST) | mail/ab/contacts/add  |                                       |
|              | (GET)  | status                |                                       |
|       X      | (POST) | tokens/csrf           |                                       |
|       X      | (POST) | tokens/download       |                                       |
|              | (GET)  | weblinks              |                                       |
|       0      | (GET)  | weblinks/subscribe    |         Server said me 'internal'     |
|       X      | (GET)  | user                  |                                       |
|       X      | (POST) | user/agree-la         |  Seper-Mega-Ultra-Alfa-Giga useless   |
|       0      | (POST) | user/edit             |  Method just for redrawing frontend   |
|              | (POST) | user/unfreeze         |                                       |
|              | (POST) | user/promo/active     |                                       |
|              | (POST) | user/promo/ignore     |                                       |
|              | (POST) | user/promo/invite     |                                       |
|              | (POST) | user/promo/join       |                                       |
|       X      | (GET)  | user/space            |                                       |
|       X      | (POST) | zip                   |                                       |
|       X      | (GET)  | mail/ab/contacts      |                                       |
|              | (POST) | mail/ab/contacts/add  |                                       |
|       X      | (GET)  | billing/rates         |                                       |
|              | (POST) | billing/change        |                                       |
|              | (POST) | billing/prolong       |                                       |
|              | (POST) | billing/cancel        |                                       |
|              | (POST) | billing/history       |                                       |
|       X      | (GET)  | trashbin              |                                       |
|       X      | (POST) | trashbin/restore      |                                       |
|       X      | (POST) | trashbin/empty        |                                       |
|       X      | (GET)  | domain/folders        |                                       |
|              | (POST) | promo/validate        |                                       |
|       X      | (POST) | notify/applink        |                                       |

### Examples of usage
I decided implement the structure of the original API so for the `file/add` request you must call the method `MailCloud_instance.api.file.add(...)`.
All realized methods are described in the table above.
#### Basic usage
```
>>> import cloud_mail_api
>>> cm = cloud_mail_api.CloudMail("email@email.com", "password")
>>> cm.auth() # This method can ask AuthCode by input() if df auth enabled, run in inputable env
True
>>> cm.print(cm.api.file.add("/Some/Local/Dir/file.txt", "/Some/Cloud/Dir/file_qwe.txt"))
{'email': 'email@email.com', 'body': '/Some/Cloud/Dir/file_qwe.txt', 'time': 1530208363765, 'status': 200}
```
#### Cookies saving/loading
For identification mail.ru use cookies.
It would be a shame if every session you would have to authenticate again, so I implemented methods to load/save cookies to a json file.
```
>>> import cloud_mail_api
>>> cm_temp = cloud_mail_api.CloudMail("email@email.com", "password")
>>> cm_temp.auth()
True
>>> cm.save_cookies_to_file("/Some/Local/Dir/cookies.json")
<RequestsCookieJar[<Cookie GarageID=7d1958e70...>]
>>> del cm_temp
>>> cm = cloud_mail_api.CloudMail("email@email.com", "password")
>>> cm.load_cookies_from_file("/Some/Local/Dir/cookies.json")
<RequestsCookieJar[<Cookie GarageID=7d1958e70...>]
>>> cm.print(cm.api.file.add("/Some/Local/Dir/file.txt", "/Some/Cloud/Dir/file_qwe.txt"))
{'email': 'email@email.com', 'body': '/Some/Cloud/Dir/file_qwe.txt', 'time': 1530208363765, 'status': 200}
```

Also there is a method `def update_cookies_from_dict(self, dict_={}, **kwargs) -> RequestsCookieJar` that has a same effect as `load_cookies_from_file`

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zeionara/karma",
    "name": "carma",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Zeio Nara",
    "author_email": "zeionara@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/33/d2/98ae65b8519b1a0dde10f9eb03590808a0219fcdccbaf6219037a5c75547/carma-0.0.4.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n    <img src=\"https://i.ibb.co/KWLVsLr/logo.png\"/>\n</p>\n\n# Karma\n\nCli tool for managing cloud mail.ru storage\n\n## Usage\n\nThe main feature is file upload. For example, to upload all files from local folder `~/foo/bar` to remote folder `/qux/quux/bar` use the following command:\n\n```sh\npython -m karma sync ~/foo/bar qux/quux\n```\n\n## Installation\n\nTo isntall from `pip`:\n\n```sh\npip install carma\n```\n\nThe tool is based on [cloud_mail_ru](https://github.com/kireevmp/mailru-cloud-api) package which is unofficial cloud.mail.ru's python API.\n\n## Original docs\n\n### All existing methods in cloud.mail.ru's API\n\n| Implemented? | Method |         Path          |           Additional Info             |\n|:------------:|:------:|:---------------------:|:-------------------------------------:|\n|              | (POST) | batch                 |                                       |\n|              | (POST) | clone                 |                                       |\n|              | (POST) | stock/save            |                                       |\n|       X      | (GET)  | dispatcher            |                                       |\n|              | (POST) | docs/token            |                                       |\n|       X      | (GET)  | file                  |                                       |\n|       X      | (POST) | file/add              |                                       |\n|       X      | (POST) | file/move             |                                       |\n|       X      | (POST) | file/remove           |                                       |\n|       X      | (POST) | file/rename           |                                       |\n|       X      | (POST) | file/copy             |                                       |\n|       X      | (POST) | file/publish          |                                       |\n|       X      | (POST) | file/unpublish        |                                       |\n|       X      | (GET)  | file/history          |                                       |\n|       X      | (GET)  | folder                |                                       |\n|       X      | (POST) | folder/add            |                                       |\n|       X      | (POST) | folder/move           |`Alias for file/move`                  |\n|       X      | (POST) | folder/remove         |`Alias for file/remove`                |\n|       X      | (POST) | folder/rename         |`Alias for file/rename`                |\n|       X      | (POST) | folder/copy           |`Alias for file/copy`                  |\n|       X      | (POST) | folder/publish        |`Alias for file/publish`               |\n|       X      | (POST) | folder/unpublish      |`Alias for file/unpublish`             |\n|       X      | (GET)  | folder/find           |                                       |\n|       X      | (GET)  | folder/invites        |                                       |\n|              | (GET)  | folder/shared/links   |                                       |\n|              | (GET)  | folder/invites/info   |                                       |\n|              | (POST) | folder/invites/reject |                                       |\n|              | (POST) | folder/mount          |                                       |\n|              | (GET)  | folder/shared/incomi  |                                       |\n|              | (GET)  | folder/shared/info    |                                       |\n|              | (POST) | folder/share          |                                       |\n|       X      | (GET)  | folder/tree           |                                       |\n|              | (POST) | folder/unmount        |                                       |\n|              | (POST) | folder/unshare        |                                       |\n|       X      | (POST) | folder/viruscan       |                                       |\n|              | (GET)  | mail/ab/contacts      |                                       |\n|              | (POST) | mail/ab/contacts/add  |                                       |\n|              | (GET)  | status                |                                       |\n|       X      | (POST) | tokens/csrf           |                                       |\n|       X      | (POST) | tokens/download       |                                       |\n|              | (GET)  | weblinks              |                                       |\n|       0      | (GET)  | weblinks/subscribe    |         Server said me 'internal'     |\n|       X      | (GET)  | user                  |                                       |\n|       X      | (POST) | user/agree-la         |  Seper-Mega-Ultra-Alfa-Giga useless   |\n|       0      | (POST) | user/edit             |  Method just for redrawing frontend   |\n|              | (POST) | user/unfreeze         |                                       |\n|              | (POST) | user/promo/active     |                                       |\n|              | (POST) | user/promo/ignore     |                                       |\n|              | (POST) | user/promo/invite     |                                       |\n|              | (POST) | user/promo/join       |                                       |\n|       X      | (GET)  | user/space            |                                       |\n|       X      | (POST) | zip                   |                                       |\n|       X      | (GET)  | mail/ab/contacts      |                                       |\n|              | (POST) | mail/ab/contacts/add  |                                       |\n|       X      | (GET)  | billing/rates         |                                       |\n|              | (POST) | billing/change        |                                       |\n|              | (POST) | billing/prolong       |                                       |\n|              | (POST) | billing/cancel        |                                       |\n|              | (POST) | billing/history       |                                       |\n|       X      | (GET)  | trashbin              |                                       |\n|       X      | (POST) | trashbin/restore      |                                       |\n|       X      | (POST) | trashbin/empty        |                                       |\n|       X      | (GET)  | domain/folders        |                                       |\n|              | (POST) | promo/validate        |                                       |\n|       X      | (POST) | notify/applink        |                                       |\n\n### Examples of usage\nI decided implement the structure of the original API so for the `file/add` request you must call the method `MailCloud_instance.api.file.add(...)`.\nAll realized methods are described in the table above.\n#### Basic usage\n```\n>>> import cloud_mail_api\n>>> cm = cloud_mail_api.CloudMail(\"email@email.com\", \"password\")\n>>> cm.auth() # This method can ask AuthCode by input() if df auth enabled, run in inputable env\nTrue\n>>> cm.print(cm.api.file.add(\"/Some/Local/Dir/file.txt\", \"/Some/Cloud/Dir/file_qwe.txt\"))\n{'email': 'email@email.com', 'body': '/Some/Cloud/Dir/file_qwe.txt', 'time': 1530208363765, 'status': 200}\n```\n#### Cookies saving/loading\nFor identification mail.ru use cookies.\nIt would be a shame if every session you would have to authenticate again, so I implemented methods to load/save cookies to a json file.\n```\n>>> import cloud_mail_api\n>>> cm_temp = cloud_mail_api.CloudMail(\"email@email.com\", \"password\")\n>>> cm_temp.auth()\nTrue\n>>> cm.save_cookies_to_file(\"/Some/Local/Dir/cookies.json\")\n<RequestsCookieJar[<Cookie GarageID=7d1958e70...>]\n>>> del cm_temp\n>>> cm = cloud_mail_api.CloudMail(\"email@email.com\", \"password\")\n>>> cm.load_cookies_from_file(\"/Some/Local/Dir/cookies.json\")\n<RequestsCookieJar[<Cookie GarageID=7d1958e70...>]\n>>> cm.print(cm.api.file.add(\"/Some/Local/Dir/file.txt\", \"/Some/Cloud/Dir/file_qwe.txt\"))\n{'email': 'email@email.com', 'body': '/Some/Cloud/Dir/file_qwe.txt', 'time': 1530208363765, 'status': 200}\n```\n\nAlso there is a method `def update_cookies_from_dict(self, dict_={}, **kwargs) -> RequestsCookieJar` that has a same effect as `load_cookies_from_file`\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Cli tool for managing cloud mail.ru storage",
    "version": "0.0.4",
    "project_urls": {
        "Bug Reports": "https://github.com/zeionara/karma/issues",
        "Documentation": "https://github.com/zeionara/karma#readme",
        "Homepage": "https://github.com/zeionara/karma",
        "Source Code": "https://github.com/zeionara/karma"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "33d298ae65b8519b1a0dde10f9eb03590808a0219fcdccbaf6219037a5c75547",
                "md5": "6ace2de41ad8c06a9ea6ab621e7ce5b3",
                "sha256": "969816b75492f6c1dedda4a69bb53e1200c81b76726622a2401ca076064a3b41"
            },
            "downloads": -1,
            "filename": "carma-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "6ace2de41ad8c06a9ea6ab621e7ce5b3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9589,
            "upload_time": "2023-12-25T22:35:05",
            "upload_time_iso_8601": "2023-12-25T22:35:05.953167Z",
            "url": "https://files.pythonhosted.org/packages/33/d2/98ae65b8519b1a0dde10f9eb03590808a0219fcdccbaf6219037a5c75547/carma-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-25 22:35:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zeionara",
    "github_project": "karma",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "carma"
}
        
Elapsed time: 2.30350s