Skip to main content

A package to upload files to OVH S3

Project description

NEXTProtocol S3File

Petit client OVH S3 pensé pour des uploads publics simples.

Installation

pip install NEXTProtocol-s3file
# mettre à jour si besoin
pip install --upgrade NEXTProtocol-s3file

Démarrage rapide

from s3file import OvhS3

s3 = OvhS3(
    endpoint="https://s3.gra.io.cloud.ovh.net",
    bucket="your-bucket-name",
    region="gra",
    key_id="YOUR_ACCESS_KEY",
    secret="YOUR_SECRET_KEY",
)

url = s3.upload_file_public("local/path/to/file.jpg")
# -> https://your-bucket.s3.gra.io.cloud.ovh.net/default_path/file.jpg

url = s3.upload_file_public(
    "photo.jpg",
    "images/2024/photo.jpg",
)
# -> https://your-bucket.s3.gra.io.cloud.ovh.net/images/2024/photo.jpg

API

OvhS3(endpoint, bucket, gra, key_id, secret)

  • prépare un client boto3 configuré pour OVH
  • garde l'endpoint public dans virtual_endpoint

upload_file_public(file_path, bucket_file_path=None)

  • crée la clé distante default_path/<nom> si aucun chemin n'est donné
  • passe l'ACL public-read
  • renvoie l'URL publique complète

Bonnes pratiques

  • vérifie tes identifiants OVH avant l'appel
  • pilote les erreurs via un try/except si tu veux une gestion custom
  • lance pip install --upgrade NEXTProtocol-s3file pour récupérer la dernière version

Prérequis

  • Python >= 3.9
  • boto3 >= 1.26.0

Licence

MIT

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

techtrash_s3file-0.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

techtrash_s3file-0.1.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file techtrash_s3file-0.1.0.tar.gz.

File metadata

  • Download URL: techtrash_s3file-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for techtrash_s3file-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c88f9f5c1f54799122117acefed3a10fa95c22b6ac305d2ed2a64ebed205cb35
MD5 941b0efb5f1750a05473666477e87faa
BLAKE2b-256 e5696c94eb29e7055cd5bc848d778b15f47e1377541bb2d030292afde627823a

See more details on using hashes here.

File details

Details for the file techtrash_s3file-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for techtrash_s3file-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 001d1bbe8479db5f9df060dae8e5e44c7b214fd3bbe4dbc8e5191030bf6f0966
MD5 b95fef9d9590f871f2b2dcd7bc66b98c
BLAKE2b-256 6efb55286cadb89f1520e65181aa916ccdf8ca0f3b57dd0ae8a8289cc63f62ee

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