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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dfd638b581ba34b738386bc9f3d10baf3601f9c7e820f92968a1d8e04bcf86a
|
|
| MD5 |
c2cf6cae70f6d6184e4005a9c3efb507
|
|
| BLAKE2b-256 |
9b3c01679b4edd22fc3dd840a5459dfa28517ee3d3885cb4eb3a7293cd3ddd65
|
Provenance
The following attestation bundles were made for oci_bucket-1.0.3.tar.gz:
Publisher:
python-publish.yml on dsantiago/oci_bucket
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oci_bucket-1.0.3.tar.gz -
Subject digest:
9dfd638b581ba34b738386bc9f3d10baf3601f9c7e820f92968a1d8e04bcf86a - Sigstore transparency entry: 221402961
- Sigstore integration time:
-
Permalink:
dsantiago/oci_bucket@30452bae69b79402031feb96fd0dbccb5180d6b7 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/dsantiago
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@30452bae69b79402031feb96fd0dbccb5180d6b7 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2120af2dd1afa35e816c286f79460b143d758e67c5762425db3e2c539229b89a
|
|
| MD5 |
5c9bb2a8f4115bd7e6faf8c53004ac8a
|
|
| BLAKE2b-256 |
8698938f293068949ba76168f4af40041d63f211f6d31d37a04801b1589bd32f
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oci_bucket-1.0.3-py3-none-any.whl -
Subject digest:
2120af2dd1afa35e816c286f79460b143d758e67c5762425db3e2c539229b89a - Sigstore transparency entry: 221402966
- Sigstore integration time:
-
Permalink:
dsantiago/oci_bucket@30452bae69b79402031feb96fd0dbccb5180d6b7 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/dsantiago
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@30452bae69b79402031feb96fd0dbccb5180d6b7 -
Trigger Event:
release
-
Statement type: