kalobtaulien / boto3_wasabi Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
Is there any way to get notfied when someone uploads file to wasabi bucket. like hitting http method, hook or something. thanks
I am able to list Buckets but unable to put_object. I updated the bucket policy to allow all operations for that User(urn)
#---Bucket Policy
{
"Id": "Policyxxxxxxx",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmtxxxxxxxx",
"Action": [
"s3:PutObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::mybucket",
"Principal": {
"AWS": [
"arn:aws:iam::xxxxxxxxx:user/uploader"
]
}
}
]
}
#-------------------------------Sample Code used --------------------
#---- Creating Sample file----
file = open('new-file.txt', 'a+')
file.write('Hello, this is my new file')
file.close()
body = open('new-file.txt', 'rb')
s3 = boto3_wasabi.client('s3',
endpoint_url = 'https://s3.wasabisys.com',
aws_access_key_id = access_key,
aws_secret_access_key =secret_key)
#---- Printing List of Buckets - it works
print(s3.list_buckets())
#---- Upload File Fails gives SignatureDoesNot Match----
upload_data = s3.put_object(Bucket=WASABI_BUCKET, Key='test.txt', Body=body, ContentType='text/plain')
body.close()
print(upload_data)
#------- Error I am receiving ------------
ClientError: An error occurred (SignatureDoesNotMatch) when calling the PutObject operation: The request signature we calculated does not match the signature you provided. Check your key and signing method.
I have a pipeline that transfer files from S3 to wasabi, with specific folder destination.
Does your boto3_wasabi support folder destination variable? (file_path use by boto3)
If yes, how do we specify it with your upload_data command?
Thank you in advance for your response!
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'
#!/usr/bin/env python3
import boto3_wasabi
def credentials(filepath='/etc/passwd-s3fs', delimiter=':'):
with open(filepath, 'r') as r:
a = r.read()
_a = a.split(delimiter)
return _a
def connect_wasabi(credentials):
return boto3_wasabi.client("s3", aws_access_key_id=credentials[0], aws_secret_access_key=credentials[1])
def list_bucket(client, Prefix, Bucket='public-videos', MaxKeys=500):
return client.list_objects(Bucket=Bucket, MaxKeys=MaxKeys, Prefix=Prefix)
def run():
auth = credentials()
client = connect_wasabi(auth)
print(list_bucket(client, '/'))
if __name__ == '__main__':
run()
File "/usr/local/lib/python3.9/site-packages/botocore/client.py", line 324, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/lib/python3.9/site-packages/botocore/client.py", line 608, in _make_api_call
http, parsed_response = self._endpoint.make_request(
File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 143, in make_request
return self._send_request(request_dict, operation_model)
File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 169, in _send_request
success_response, exception = self._get_response(
File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 247, in _get_response
parsed_response = parser.parse(
File "/usr/local/lib/python3.9/site-packages/botocore/parsers.py", line 210, in parse
parsed = self._do_error_parse(response, shape)
File "/usr/local/lib/python3.9/site-packages/botocore/parsers.py", line 750, in _do_error_parse
return self._parse_error_from_body(response)
File "/usr/local/lib/python3.9/site-packages/botocore/parsers.py", line 774, in _parse_error_from_body
self._replace_nodes(parsed)
File "/usr/local/lib/python3.9/site-packages/botocore/parsers.py", line 395, in _replace_nodes
if value.getchildren():
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'
Hi I would like to use wasabi in my django project but I can't seem to get it I don't have the necessary resources
Please help me if possible.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.