Code Monkey home page Code Monkey logo

b2-python-s3-sample's People

Contributors

databased avatar metadaddy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

b2-python-s3-sample's Issues

Getting error while uploading file to private bucket in BB

I am trying to upload a file to a private bucket in BB. The code sample here is what I am trying.

Firstly, there are two API endpoint variables in the settings - ENDPOINT (with a given value) and ENDPOINT_URL_YOUR_BUCKET. What is the difference between them? The private bucket I have created shows endpoint variable having value as s3.us-east-005.backblazeb2.com (almost similar to the ENDPOINT value provided in the settings file), is that to be used for both? Otherwise, what is to be filled in each of these two?

Secondly, what are ENDPOINT_URL_YOUR_BUCKET, KEY_ID_YOUR_ACCOUNT and APPLICATION_KEY_YOUR_ACCOUNT, all of which are needed to upload a file to a private bucket? Where do I get these values from? For the bucket, when I generated an application-key, I got an applicationKey and keyId (I added read write access for the application-key), but they are applicable to the APPLICATION_KEY_PRIVATE_RO and KEY_ID_PRIVATE_RO variables in the script, so where do those three variables come from?

Bug: get_b2_resource(endpoint, key_id, application_key)

diff --git a/sample.py b/sample.py
index 9075619..be1c72e 100644
--- a/sample.py
+++ b/sample.py
@@ -113,9 +113,8 @@ def get_b2_client(endpoint, keyID, applicationKey):
                                  aws_secret_access_key=applicationKey) # Backblaze applicationKey
         return b2_client
 
-
 # Return a boto3 resource object for B2 service
-def get_b2_resource(endpoint, key_id, application_key):
+def get_b2_resource(endpoint, keyID, applicationKey):
     b2 = boto3.resource(service_name='s3',
                         endpoint_url=endpoint,                # Backblaze endpoint
                         aws_access_key_id=keyID,              # Backblaze keyID

There is a simple typo in the signature/variable names

generate_presigned_url runs 27 times

Hey,

So I've been using your functions and for some unknown reason the get_presgined_url functions runs 27 times everytime I call it:
def get_object_presigned_url(key, expiration_seconds, b2):
try:
response = b2.meta.client.generate_presigned_url(ClientMethod='get_object',
ExpiresIn=expiration_seconds,
Params={
'Bucket': bucket,
'Key': key
} )
print(response)
return response
except ClientError as ce:
print('error', ce)

Any idea why would that happen?

v2 just doesn't work

Hi,

So i'm getting up to speed with using b2 buckets and the boto library. After cloning the repo and opening the sample project in my ide, i first read thru the article at Backblaze B2 Quick Start: Using Python With the Backblaze S3 Compatible API and gathered a fairly good understanding of the code. I then tried just running it and encountered a wall of text in errors from python. So i then watched the youtube explainer video. Part 1 at least presents a greatly simplified overview, basically matching what i had gathered in reading the article. However in the video the code executes without issue, successfully making the request and receiving bucket data.

With the understanding that this should work, i created a new python file, called it sample minimal and pulled out just the basic minimal parts that should run and replicate the success that the video had. Another wall of text from python in errors and ending with "ValueError: Invalid endpoint: https://s3.us-west-002.backblazeb2.com".

I then searched the repository for issues, finding only one that didn't match my trouble, then checked branches, and found the v1.0 branch. Surprise, v1.0 works like a charm. After spending now a couple hours familiarizing myself with the project, i was quickly able to read and make sense of the simplified v1.0 version and was successful in running the code, without a mess of python errors or any other issues.

I just wanted to bring this to your attention, basically the v2.0 branch which is what downloads by default when cloning the repo is either broken or requires additional information, while the v1.0 just works. As an intro to working with B2, the successful result would be far more advantageous for new users who may not be as stubborn as i was today.

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.