{ "info": { "author": "Vitaly Zuevsky", "author_email": "vitaly.zuevsky@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "## Akamai NetStorage API for Python\n```diff\n+ pip install anesto\n```\n\n\n#### Common Variables\n\n`arl` or Akamai Resource Locator, here, is a NetStorage target for an operation; examples are\n```\nakamai://example-nsu.akamaihd.net/395007/my/path/special.log\nakamai://example-nsu.akamaihd.net/395007/my/path/\nexample-nsu.akamaihd.net/395007/my\nexample-nsu.akamaihd.net/395007\n```\nThe host name and CP code (here `395007`) are two required elements of the `arl`.\nTrailing slash doesn't indicate files inside the target folder, so avoiding it is a cleaner practice.\n\n`key` and `keyname` - a pair you must have for authentication when using NetStorage.\n\n\nYou can start working with NetStorage like so:\n```python\nimport anesto\n\nns = anesto.Client() # this will have the same effect as :\nns = anesto.Client(retry_number=3, conn_timeout=6, read_timeout=9, url_safe_chars='/~')\n```\nAll functions available by `ns` rely on [Requests module](https://2.python-requests.org/en/master/api/#main-interface) and return [Response object](https://2.python-requests.org/en/master/api/#requests.Response), from where you can get all request-response headers and the status code.\n\nWhen renaming or removing a target you may wish to treat 404 response as success because when HTTP request is initially delivered but associated response is lost, and the client retries the same request on timeout, the server returns 404 as the job has already been done, and the old target is no longer there. You may change timeout-retry behaviour on `Client()` instance as per above.\n\n`url_safe_chars` is exposed to let you deal with implementations being out of sync, [url-encoding of tilda](https://stackoverflow.com/questions/51334226/python-why-is-now-included-in-the-set-of-reserved-characters-in-urllib-pars) is one example.\n\n\n#### Available Functions\n\nAny function can be used like so:\n```python\nkey = ''\nkeyname = ''\n\nns.download(arl, key, keyname, saveto)\n# arl e.g. akamai://example-nsu.akamaihd.net/395007/my/path/special.log\n# saveto is an existing folder or a file target, e.g. '~/Downloads'\n# files only\n```\nWe further assume that `key` and `keyname` are defined...\n```python\nns.upload(arl, key, keyname, file)\n# arl e.g. akamai://example-nsu.akamaihd.net/395007/my/path/special.log\n# file e.g. `~/Documents/special.log`\n# files only\n```\n\n```python\nns.delete(arl, key, keyname)\n# files and symlinks only\n```\n\n```python\nprint(ns.xdir(arl, key, keyname).text)\n# xdir().text returns XML string describing contents of a folder specified by arl\n# folders only\n```\n\n```python\nprint(ns.xdu(arl, key, keyname).text)\n# xdu().text returns XML string with metadata, such as total number of files and\n# disk space taken by a folder specified by arl\n# folders only\n```\n\n```python\nns.mkdir(arl, key, keyname)\n# creates a folder\n```\n\n```python\nns.mtime(arl, key, keyname, 988888888) # cannot change folders\n# changes modification time stamp to unix epoch specified e.g.\n```\n\n```python\nns.quickdelete(arl, key, keyname)\n# Recursive folder remover - must be explicitly enabled by Akamai, see rmdir_rec() below\n# folders only\n```\n\n```python\nns.rename(arl, key, keyname, uri):\n# all path folders must exist, moves under same CP code only\n# uri e.g. \"/395007/mypath/dir-v-test/vtest2\"\n# uri e.g. \"../vtest\" (relative to arl)\n# files and symlinks only\n```\n\n```python\nns.rmdir(arl, key, keyname)\n# removes an empty folder\n# folders only\n```\n\n```python\nns.rmdir_rec(arl, key, keyname)\n# removes a folder recursively\n# Only recursive function here with many HTTP calls. May crash on stack overflow\n# folders only\n```\n\n```python\nprint(ns.stat(arl, key, keyname).text)\n# stat().text returns XML string describing metadata of any target specified by arl\n# folders, files, symlinks\n```\n\n```python\nns.symlink(arl, key, keyname, target)\n# creates a symlink specified by arl\n# target e.g. \"/395007/my/path/dir-v-test/vtest2\"\n# target e.g. \"../vtest/\" (relative to arl)\n```\nSymlinks does not work as such when you access NetStorage, they are followed by Akamai CDN using them as the origin.\n\n\n-----------\n*Packaging*\n```\npip install --upgrade setuptools wheel twine\npython3 setup.py sdist bdist_wheel\ntwine upload dist/*\nrm -r dist build anesto.egg-info\n```\n\n\n", "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/psvz/anesto", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "anesto", "package_url": "https://pypi.org/project/anesto/", "platform": "", "project_url": "https://pypi.org/project/anesto/", "project_urls": { "Homepage": "https://github.com/psvz/anesto" }, "release_url": "https://pypi.org/project/anesto/1.0/", "requires_dist": [ "requests (>=2.21.0)" ], "requires_python": ">=3.6", "summary": "Akamai NetStorage API for Python", "version": "1.0" }, "last_serial": 5829034, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "46c3bf379479a4f1a15518b2f780fa52", "sha256": "527d714469b1d6067f0edbe9853e7bd166c3d99431d86ff9f4470619bfd5cf36" }, "downloads": -1, "filename": "anesto-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "46c3bf379479a4f1a15518b2f780fa52", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 5976, "upload_time": "2019-09-14T10:29:23", "url": "https://files.pythonhosted.org/packages/6a/f4/4d9917b52f60d003e16e8c7eb4f8cde7440cc81466fc624d79cc8e24e0d0/anesto-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "10d26d6175c450f7645c5e5f0314dcbf", "sha256": "aff387aecfa1360b0549cf309411001bc2871a8818ef0ff457b0124b0a05625b" }, "downloads": -1, "filename": "anesto-1.0.tar.gz", "has_sig": false, "md5_digest": "10d26d6175c450f7645c5e5f0314dcbf", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 4904, "upload_time": "2019-09-14T10:29:25", "url": "https://files.pythonhosted.org/packages/dc/fe/3ae47c931084c40ece6e37520e50e2297edad95d9ca995c0dd53edfdc6bd/anesto-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "46c3bf379479a4f1a15518b2f780fa52", "sha256": "527d714469b1d6067f0edbe9853e7bd166c3d99431d86ff9f4470619bfd5cf36" }, "downloads": -1, "filename": "anesto-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "46c3bf379479a4f1a15518b2f780fa52", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 5976, "upload_time": "2019-09-14T10:29:23", "url": "https://files.pythonhosted.org/packages/6a/f4/4d9917b52f60d003e16e8c7eb4f8cde7440cc81466fc624d79cc8e24e0d0/anesto-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "10d26d6175c450f7645c5e5f0314dcbf", "sha256": "aff387aecfa1360b0549cf309411001bc2871a8818ef0ff457b0124b0a05625b" }, "downloads": -1, "filename": "anesto-1.0.tar.gz", "has_sig": false, "md5_digest": "10d26d6175c450f7645c5e5f0314dcbf", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 4904, "upload_time": "2019-09-14T10:29:25", "url": "https://files.pythonhosted.org/packages/dc/fe/3ae47c931084c40ece6e37520e50e2297edad95d9ca995c0dd53edfdc6bd/anesto-1.0.tar.gz" } ] }