Code Monkey home page Code Monkey logo

boto3_wasabi's People

Contributors

kalobtaulien avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

boto3_wasabi's Issues

error cant use your library

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'

SignatureDoesNotMatch error when calling the PutObject operation

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()

Open the file as readable

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 your file

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.

wassabi for DJango 2.2 or Django 3

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.

Specify Destination folder of wasabi bucket

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.