Socket
Socket
Sign inDemoInstall

s3urls

Package Overview
Dependencies
0
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    s3urls

Parse and build Amazon S3 URLs


Maintainers
1

Readme

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/'

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc