Package: carma
KarmaCli tool for managing cloud mail.ru storageUsageThe main feature is file upload. For example, to upload all files from local folder~/foo/barto remote folder/qux/quux/baruse the following command:python-mkarmasync~/foo/barqux/quuxInstallationTo isntall frompip:pipinstallcarmaThe tool is based oncloud_mail_rupackage which is unofficial cloud.mail.ru's python API.Original docsAll existing methods in cloud.mail.ru's APIImplemented?MethodPathAdditional Info(POST)batch(POST)clone(POST)stock/saveX(GET)dispatcher(POST)docs/tokenX(GET)fileX(POST)file/addX(POST)file/moveX(POST)file/removeX(POST)file/renameX(POST)file/copyX(POST)file/publishX(POST)file/unpublishX(GET)file/historyX(GET)folderX(POST)folder/addX(POST)folder/moveAlias for file/moveX(POST)folder/removeAlias for file/removeX(POST)folder/renameAlias for file/renameX(POST)folder/copyAlias for file/copyX(POST)folder/publishAlias for file/publishX(POST)folder/unpublishAlias for file/unpublishX(GET)folder/findX(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/shareX(GET)folder/tree(POST)folder/unmount(POST)folder/unshareX(POST)folder/viruscan(GET)mail/ab/contacts(POST)mail/ab/contacts/add(GET)statusX(POST)tokens/csrfX(POST)tokens/download(GET)weblinks0(GET)weblinks/subscribeServer said me 'internal'X(GET)userX(POST)user/agree-laSeper-Mega-Ultra-Alfa-Giga useless0(POST)user/editMethod just for redrawing frontend(POST)user/unfreeze(POST)user/promo/active(POST)user/promo/ignore(POST)user/promo/invite(POST)user/promo/joinX(GET)user/spaceX(POST)zipX(GET)mail/ab/contacts(POST)mail/ab/contacts/addX(GET)billing/rates(POST)billing/change(POST)billing/prolong(POST)billing/cancel(POST)billing/historyX(GET)trashbinX(POST)trashbin/restoreX(POST)trashbin/emptyX(GET)domain/folders(POST)promo/validateX(POST)notify/applinkExamples of usageI decided implement the structure of the original API so for thefile/addrequest you must call the methodMailCloud_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/loadingFor 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 methoddef update_cookies_from_dict(self, dict_={}, **kwargs) -> RequestsCookieJarthat has a same effect asload_cookies_from_file