Skip to main content

Package for easy Oci Buckets management in python.

Project description

OCI Bucket Framework

For easier OCI blob manipulation, read, download, etc.

Import

from oci_bucket import OciBucket

Load from Instance Principal

storage_client = OciBucket.client().from_instance_principal()
oci_bucket = OciBucket(storage_client, bucket_name)

Load from OCI Config File

storage_client = OciBucket.client().from_file() # Defaults to ~/.oci/config
oci_bucket = OciBucket(storage_client, bucket_name)

Methods

Note that limit is set to 1000 by default, this limitation comes from original oci.object_storage.ObjectStorageClient.object_list. This lib can go further and handle the pagination for you, just use limit beyond 1000.

files = oci_bucket.list_folder('multiples', limit=12) # retrives files from directory
files = oci_bucket.glob('multiples/1{1,2}0{3,4}.txt', limit=30) # Linux ls pattern can be used for blob filtering.
files = oci_bucket.glob('*audio*wav', limit=30) # Using wildcard '*'
file = oci_bucket.get_file('multiples/0005.txt') # Or just retrieve a specifi file directly

Handling Files in Bucket

oci_bucket.upload_file('acdc.csv', 'csvs') # Upload local file to bucket
oci_bucket.get_file('csvs/acdc.csv').download('local_dir') # Download buckt file to local
oci_bucket.get_file('csvs/acdc.csv').copy('new_csvs') # Copies a file in a bucket to another
oci_bucket.get_file('csvs/acdc.csv').move('new_csvs') # Moves a file in a bucket to another
oci_bucket.get_file('csvs/acdc.csv').delete() # Deletes a file in bucket

Blob Usage

As you can retrieve both a list of files or just a specific one, the blob files have methods on their own.

Load Pandas dataframe Direct From CSV file bytes.

import pandas as pd
from io import BytesIO
file_bytes = oci_bucket.get_file('csvs/acdc.csv').get_bytes()
df = pd.read_csv(BytesIO(file_bytes))

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

oci_bucket-1.0.3.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

oci_bucket-1.0.3-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file oci_bucket-1.0.3.tar.gz.

File metadata

  • Download URL: oci_bucket-1.0.3.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for oci_bucket-1.0.3.tar.gz
Algorithm Hash digest
SHA256 9dfd638b581ba34b738386bc9f3d10baf3601f9c7e820f92968a1d8e04bcf86a
MD5 c2cf6cae70f6d6184e4005a9c3efb507
BLAKE2b-256 9b3c01679b4edd22fc3dd840a5459dfa28517ee3d3885cb4eb3a7293cd3ddd65

See more details on using hashes here.

Provenance

The following attestation bundles were made for oci_bucket-1.0.3.tar.gz:

Publisher: python-publish.yml on dsantiago/oci_bucket

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file oci_bucket-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: oci_bucket-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for oci_bucket-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2120af2dd1afa35e816c286f79460b143d758e67c5762425db3e2c539229b89a
MD5 5c9bb2a8f4115bd7e6faf8c53004ac8a
BLAKE2b-256 8698938f293068949ba76168f4af40041d63f211f6d31d37a04801b1589bd32f

See more details on using hashes here.

Provenance

The following attestation bundles were made for oci_bucket-1.0.3-py3-none-any.whl:

Publisher: python-publish.yml on dsantiago/oci_bucket

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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