Skip to main content

Parse and build Amazon S3 URLs

Project description

S3urls

Parse and build Amazon S3 URLs.

Usage

Parse S3 URLs

from s3urls import parse_url

>>> parse_url('https://my-bucket.s3.amazonaws.com/my-key/')
{'bucket': 'my-bucket', 'key': 'my-key/'}

>>> parse_url('https://s3-eu-west-1.amazonaws.com/my-bucket/my-key/')
{'bucket': 'my-bucket', 'key': 'my-key/'}

>>> parse_url('s3://my-bucket/my-key')
{'bucket': 'my-bucket', 'key': 'my-key/'}

>>> parse_url('s3://user@my-bucket/my-key')
{'bucket': 'my-bucket', 'key': 'my-key/', 'credential_name': 'user'}

Build S3 URLs

from s3urls import build_url

>>> build_url('s3', 'my-bucket', 'my-key/')
's3://my-bucket/my-key/'

>>> build_url('s3', 'my-bucket', 'my-key/', credential_name='user')
's3://user@my-bucket/my-key/'

>>> build_url('bucket-in-path', 'my-bucket', 'my-key/')
'https://s3.amazonaws.com/my-bucket/my-key/'

>>> build_url('bucket-in-path', 'my-bucket', 'my-key/', region='eu-west-1')
'https://s3-eu-west-1.amazonaws.com/my-bucket/my-key/'

>>> build_url('bucket-in-netloc', 'my-bucket', 'my-key/')
'https://my-bucket.s3.amazonaws.com/my-key/'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

s3urls-0.0.3.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

s3urls-0.0.3-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file s3urls-0.0.3.tar.gz.

File metadata

  • Download URL: s3urls-0.0.3.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for s3urls-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f9efcb58df15da6c2d6fe7e64ccfaf17f464648bf3c832ea80d50199069241d4
MD5 6d4abb6c02fae3f660d4fde08a508aa6
BLAKE2b-256 d8fef2f0be1ab72c63a5c351c485fe37af9ea781985278e51236874df17b136f

See more details on using hashes here.

File details

Details for the file s3urls-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for s3urls-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7540c2523848252e04e69f31ec81364fe09d24d4ee0709227192e8e6124b1dfa
MD5 24bad09bdd6ff813b6df3eb0528b9304
BLAKE2b-256 785b5f3cab12639c96232e1ae964c593a9f8292e7454401878bd99d14c0d0e6a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page