{ "info": { "author": "Lior Mizrahi", "author_email": "li.mizr@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "S3Path\n======\n\n.. image:: https://badgen.net/pypi/v/s3path\n :target: https://pypi.org/project/s3path/\n :alt: Latest version\n\n.. image:: https://badgen.net/travis/liormizr/s3path/\n :target: https://travis-ci.com/liormizr/s3path\n :alt: Travis-CI\n\nS3Path provide a Python convenient File-System/Path like interface for AWS S3 Service using boto3 S3 resource as a driver.\n\nLike pathlib, but for S3 Buckets\n________________________________\n\nAWS S3 is among the most popular cloud storage solutions. It's object storage, is built to store and retrieve various amounts of data from anywhere.\n\nCurrently, Python developers use Boto3 as the default API to connect / put / get / list / delete files from S3.\n\nS3Path blends Boto3's ease of use and the familiarity of pathlib api.\n\nInstall:\n========\n\n.. code:: bash\n\n $ pip install s3path\n\nBasic use:\n==========\n\nThe following example assumes an s3 bucket setup as specified bellow:\n\n.. code:: bash\n\n $ aws s3 ls s3://pypi-proxy/\n\n 2018-04-24 22:59:59 186 requests/index.html\n 2018-04-24 22:59:57 485015 requests/requests-2.9.1.tar.gz\n 2018-04-24 22:35:01 89112 boto3/boto3-1.4.1.tar.gz\n 2018-04-24 22:35:02 180 boto3/index.html\n 2018-04-24 22:35:19 3308919 botocore/botocore-1.4.93.tar.gz\n 2018-04-24 22:35:36 188 botocore/index.html\n\nImporting the main class:\n\n.. code:: python\n\n >>> from s3path import S3Path\n\nListing \"subdirectories\" - s3 keys can be split like file-system with a `/` in s3path we:\n\n.. code:: python\n\n >>> bucket_path = S3Path('/pypi-proxy/')\n >>> [path for path in bucket_path.iterdir() if path.is_dir()]\n [S3Path('/pypi-proxy/requests/'),\n S3Path('/pypi-proxy/boto3/'),\n S3Path('/pypi-proxy/botocore/')]\n\nListing html source files in this \"directory\" tree:\n\n.. code:: python\n\n >>> bucket_path = S3Path('/pypi-proxy/')\n >>> list(bucket_path.glob('**/*.html'))\n [S3Path('/pypi-proxy/requests/index.html'),\n S3Path('/pypi-proxy/boto3/index.html'),\n S3Path('/pypi-proxy/botocore/index.html')]\n\nNavigating inside a \"directory\" tree:\n\n.. code:: python\n\n >>> bucket_path = S3Path('/pypi-proxy/')\n >>> boto3_package_path = bucket_path / 'boto3' / 'boto3-1.4.1.tar.gz'\n >>> boto3_package_path\n S3Path('/pypi-proxy/boto3/boto3-1.4.1.tar.gz')\n\nQuerying path properties:\n\n.. code:: python\n\n >>> boto3_package_path = S3Path('/pypi-proxy/boto3/boto3-1.4.1.tar.gz')\n >>> boto3_package_path.exists()\n True\n >>> boto3_package_path.is_dir()\n False\n >>> boto3_package_path.is_file()\n True\n\nOpening a \"file\" (s3 key):\n\n.. code:: python\n\n >>> botocore_index_path = S3Path('/pypi-proxy/botocore/index.html')\n >>> with botocore_index_path.open() as f:\n >>> print(f.read())\n \"\"\"\n \n \n
\n \n