Skip to content

Commit

Permalink
Make b2 work again
Browse files Browse the repository at this point in the history
I feel like this thing breaks every time I look at it. Probably will
just use boto (or smart_open and give up on direct api calls entirely),
but for now...
  • Loading branch information
sz3 committed Jun 29, 2024
1 parent a9c528f commit 3fad10e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pog/fs/b2fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
from subprocess import check_output

from b2sdk.v2 import B2Api
from b2sdk.exception import FileNotPresent
from b2sdk.v2.exception import FileNotPresent

from .pogfs import Pogfs


BUCKET_NAME = environ.get('B2_BUCKET_NAME')
APP_ID = environ.get('B2_APPLICATION_KEY_ID')
APP_SECRET = environ.get('B2_APPLICATION_KEY')


class b2fs(Pogfs):
Expand All @@ -18,6 +20,7 @@ def __init__(self, bucket_name=None, **kwargs):

def _get_bucket(self):
api = B2Api()
api.authorize_account('production', APP_ID, APP_SECRET)
return api.get_bucket_by_name(self.bucket_name)

def exists(self, remote_path):
Expand Down

0 comments on commit 3fad10e

Please sign in to comment.