marazmiki / s3-parse-url

A small tool to parse URLs for S3 compatible storage services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

s3-parse-url

PyPI - Python Version

PyPI

PyPI - License

image

Codacy grade


Parses S3 credentials from the given string and returns it in comfortable format to pass to popular clients like boto3.

About

This is a small utility to parse locations of buckets of S3-compatible storage (and, of course, the original Amazon's S3 itself) given in the URL form like s3://bucket/.

It could be useful in our epoch of the 12-factor applications when it's a good practice to store credentials inside of environment variables.

Also, these days, there are some notable S3-compatible storage services:

  • Selectel
  • MinIO (a self-hosted solution extremely handy for testing)

And dozens of others.

With s3-parse-url, you can use any one of these services with no doubts about configuration endpoints. For example, you can connect to your Selectel storage with boto3 just using selectel://my-bucket DSN.

That's an example, what it was all about:

Of course, in the code above we worked with Selectel (have you ever heard about it?). You can work this way with any S3 compatible storage. If you prefer unknown storage, you can easily create a plugin to add support for your favorite service. Or, if you are a pervert, you can use a universal S3:// scheme, but in this case, you should manage endpoints by yourself:

Supported providers

Currently we have support for these storages

  • Amazon S3
  • Selectel
  • Yandex
  • Mail.ru
  • MinIO

But you can easily add your own one.

License

This project is licensed under the terms of the MIT license.

About

A small tool to parse URLs for S3 compatible storage services


Languages

Language:Python 100.0%