{ "info": { "author": "Sanket Saurav", "author_email": "sanketsaurav@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "\n# S3Tree \ud83c\udf32\n\n[![Build Status](https://travis-ci.org/sanketsaurav/s3tree.svg?branch=master)](https://travis-ci.org/sanketsaurav/s3tree) [![Coverage Status](https://coveralls.io/repos/github/sanketsaurav/s3tree/badge.svg?branch=master)](https://coveralls.io/github/sanketsaurav/s3tree?branch=master) [![Maintainability](https://api.codeclimate.com/v1/badges/8422f69519a864a93df2/maintainability)](https://codeclimate.com/github/sanketsaurav/s3tree/maintainability)\n\nS3Tree allows you to access files stored on Amazon AWS S3 as a simple directory tree. You can traverse the tree and read files as easily as\nyou `os.walk`.\n\n```python\n>>> import s3tree\n>>> s3tree.config.aws_access_key_id = ''\n>>> s3tree.config.aws_secret_access_key = ''\n>>> tree = s3tree.S3Tree(bucket_name='my-awesome-bucket')\n>>> len(tree)\n77\n>>> for obj in tree: print(obj.name)\n...\nadmin\nassets\n...\nindex.js\n```\n\n## Installation\n\nTo install S3Tree, use pipenv (or pip):\n\n```\n$ pipenv install s3tree\n```\n\n\n## Documentation\n\n### Using AWS credentials\n\nThe `s3tree` module exposes a `config` object that can be used to set the AWS credentials you want to use\nglobally. You should ideally do this before you make any instances of `S3Tree`.\n\n```python\n>>> import s3tree\n>>> s3tree.config.aws_access_key_id = ''\n>>> s3tree.config.aws_secret_access_key = ''\n```\n\nCredentials can also be passed while creating an `S3Tree` instance:\n\n```python\n>>> tree = s3tree.S3Tree('dummy-bucket', aws_access_key_id='', aws_secret_access_key='')\n```\nPassing the credentials during instance creation overrides the global config.\n\n### Fetching a tree\n\nThe `S3Tree` object represents a tree at any given path. The path can be specified while creating a new tree.\nIf no path, or `/` is passed, the root if the bucket is fetched.\n\n```python\n>>> tree = s3tree.S3Tree(bucket_name='dummy') # tree at the root of the bucket `dummy`\n>>> tree = s3tree.S3Tree(bucket_name='dummy', path='/admin/css') # tree under the path `/admin/css`\n>>> tree = s3tree.S3Tree(bucket_name='dummy', path='admin/css') # this works too.\n```\nThe `tree` object above is an iterable that contains all files and directories in this tree. `len(tree)` gives you the total size of this tree.\nIf you want to access files and directories separately:\n\n```python\n>>> tree.directories # iterable for all the directories in the tree\n>>> tree.files # iterable for all the files in the tree\n```\n\nThe S3Tree object can be easily represented as JSON:\n\n```python\n>>> tree.as_json\n```\n\n### The Directory object\nEach element in `tree.directories` is a `Directory` object. This has attributes that help you\ndisplay the directory in a human-friendly manner, and methods to fetch the tree under itself.\n\n```python\n>>> mydir = tree.directories[0]\n>>> mydir.name # the name of this directory\ncss\n>>> mydir.path # the full path of this directory\n/admin/css\n>>> child_tree = mydir.get_tree() # retrieve and store the tree under `mydir` to `child_tree`\n>>> json_data = mydir.as_json # JSON representation of this directory\n```\n\n### The File object\nEach element in `tree.files` is a `File` object, which has attributes and methods to display properties\nand read the file.\n\n```python\n>>> myfile = tree.files[0]\n>>> myfile.name # name of this file\nindex.js\n>>> myfile.size # human-readable size of this file\n4 KB\n>>> contents = myfile.read() # reads the file and stores its contents in `contents`\n>>> json_data = myfile.as_json # JSON representation of this file obj\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/sanketsaurav/s3tree", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "s3tree", "package_url": "https://pypi.org/project/s3tree/", "platform": "", "project_url": "https://pypi.org/project/s3tree/", "project_urls": { "Homepage": "https://github.com/sanketsaurav/s3tree" }, "release_url": "https://pypi.org/project/s3tree/0.3.0/", "requires_dist": [ "boto3", "future", "mimelib", "six" ], "requires_python": ">=2.7.0", "summary": "Access S3 objects like tree.", "version": "0.3.0" }, "last_serial": 3971476, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "b73808a5a8134319296024b13dfe8dd8", "sha256": "aa969ed037ffe399b4d8d61185896e8eb93756652521e2e99f193788c8466a8a" }, "downloads": -1, "filename": "s3tree-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b73808a5a8134319296024b13dfe8dd8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7.0", "size": 6539, "upload_time": "2018-05-25T06:31:08", "url": "https://files.pythonhosted.org/packages/4f/e3/bf78523b86213fa14c413334f22a224b134788559212a3bc7518e53e086b/s3tree-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e5e0baa21df0aa2e3109853a2885351c", "sha256": "9bc3eea37029f4aa0a891d92a7b2152ba7ca0ed9bf11672ea692af433ec7a83b" }, "downloads": -1, "filename": "s3tree-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e5e0baa21df0aa2e3109853a2885351c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7.0", "size": 6262, "upload_time": "2018-05-25T06:31:09", "url": "https://files.pythonhosted.org/packages/e6/38/2048826d45d3c4e2a414fbf466fb015e519ba2141740cb622f01a671e6b6/s3tree-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "a324a9537580b49fbf42e36e6794fe7b", "sha256": "cfdbedd1584aec0a84dfe922c3d4ccce8ce7e8135eb8f0edd46d5a301419e79b" }, "downloads": -1, "filename": "s3tree-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a324a9537580b49fbf42e36e6794fe7b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7.0", "size": 7602, "upload_time": "2018-05-25T12:06:41", "url": "https://files.pythonhosted.org/packages/da/ac/a0d6e1f7c32ea950bac2f036fd3004db7b5fa6f0d809a2c6f3fc65dff336/s3tree-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a3d9c9042cd9d49d1bb4016de3937e6d", "sha256": "5aab055e44ea317aaf174b4948885b9ee68858cb40d60a73ee3776589b2ee4e5" }, "downloads": -1, "filename": "s3tree-0.1.1.tar.gz", "has_sig": false, "md5_digest": "a3d9c9042cd9d49d1bb4016de3937e6d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7.0", "size": 7470, "upload_time": "2018-05-25T12:06:43", "url": "https://files.pythonhosted.org/packages/5d/ff/c7a401154ebc20c936a8958ce3b039869d769e23c083d820987cf32a3d18/s3tree-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "bd443044f91310fcc17bf9e72d6fd731", "sha256": "a4e43bc3489407ed7ee021eba122c198aaf2d9014dd84481d557a7b152cd0b24" }, "downloads": -1, "filename": "s3tree-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bd443044f91310fcc17bf9e72d6fd731", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7.0", "size": 8245, "upload_time": "2018-05-26T20:21:40", "url": "https://files.pythonhosted.org/packages/8d/27/14bab9ed5c163cbed3b5ae5286637d62ea05c13a6f0e80be6a34d3f5b04d/s3tree-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4cf280b4a364feb4888bc15711596d83", "sha256": "9c12abbbd280f62059c8984e9b63c5dc3b3580784fcc82b5d6108c9a4be02c18" }, "downloads": -1, "filename": "s3tree-0.2.0.tar.gz", "has_sig": false, "md5_digest": "4cf280b4a364feb4888bc15711596d83", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7.0", "size": 8033, "upload_time": "2018-05-26T20:21:42", "url": "https://files.pythonhosted.org/packages/57/17/7f9fbffe322f109d99bd70c0a8dcc0d4dc359c1e7195c605e53d7dd654f7/s3tree-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "ad46b0d1484ac83ecc4d946fa89f7020", "sha256": "b6e549459ec5d86badcae529786f4e3ca9c7dae608bff97c487a1c50bf9faf28" }, "downloads": -1, "filename": "s3tree-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ad46b0d1484ac83ecc4d946fa89f7020", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7.0", "size": 8321, "upload_time": "2018-06-17T17:39:02", "url": "https://files.pythonhosted.org/packages/50/b5/fbe9e438b1d131e485cc3cdb52c93be7b4f3815f91c5bab87bbdc47dcbba/s3tree-0.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a08284bb20eee9e1a083cac62c530603", "sha256": "9e03d11e276420b684e1e403168fc1d87db844ca088a70db8ee3867502dfa6cd" }, "downloads": -1, "filename": "s3tree-0.3.0.tar.gz", "has_sig": false, "md5_digest": "a08284bb20eee9e1a083cac62c530603", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7.0", "size": 8505, "upload_time": "2018-06-17T17:39:04", "url": "https://files.pythonhosted.org/packages/fb/b3/977d073a35a0db894e40cf42ddb457346f8ccf574b6c03fc23f09801c780/s3tree-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ad46b0d1484ac83ecc4d946fa89f7020", "sha256": "b6e549459ec5d86badcae529786f4e3ca9c7dae608bff97c487a1c50bf9faf28" }, "downloads": -1, "filename": "s3tree-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ad46b0d1484ac83ecc4d946fa89f7020", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7.0", "size": 8321, "upload_time": "2018-06-17T17:39:02", "url": "https://files.pythonhosted.org/packages/50/b5/fbe9e438b1d131e485cc3cdb52c93be7b4f3815f91c5bab87bbdc47dcbba/s3tree-0.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a08284bb20eee9e1a083cac62c530603", "sha256": "9e03d11e276420b684e1e403168fc1d87db844ca088a70db8ee3867502dfa6cd" }, "downloads": -1, "filename": "s3tree-0.3.0.tar.gz", "has_sig": false, "md5_digest": "a08284bb20eee9e1a083cac62c530603", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7.0", "size": 8505, "upload_time": "2018-06-17T17:39:04", "url": "https://files.pythonhosted.org/packages/fb/b3/977d073a35a0db894e40cf42ddb457346f8ccf574b6c03fc23f09801c780/s3tree-0.3.0.tar.gz" } ] }