Coder Social home page Coder Social logo

wardpearce / backblaze Goto Github PK

View Code? Open in Web Editor NEW
9.0 4.0 2.0 845 KB

Asynchronous & synchronous Wrapper for Backblaze's B2

Home Page: https://backblaze.readthedocs.io/en/latest/

License: GNU General Public License v3.0

Python 98.65% Makefile 0.61% Batchfile 0.73%
b2 backblaze aio aiob2 asynchronous await awaiting wrapper synchronous blocking sync s3 python

backblaze's Introduction

No longer being actively maintained

Welcome to Backblaze's unofficial python wrapper!

This is a unofficial asynchronous & synchronous wrapper for Backblaze's B2 API.

The awaiting version requires Python 3.7 or above!

Features:

  • Full API coverage.
  • Static typing with PyRight.
  • Background authentication.
  • Asynchronous & synchronous support.
  • Easy to use with an object oriented design.
  • Unit testing.
  • Upload URL caching.
  • Rate limit handler.

Install

  • Pip:pip3 install backblaze
  • Git:pip3 install git+https://github.com/WardPearce/backblaze.git

Examples

Documentation

Documentation

Thanks to

backblaze's People

Contributors

philiperleal avatar wardpearce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

backblaze's Issues

Error in accessing files from bucket

Dear developers,

Given the actual release of this Backblaze (branch master) package, there are some small typos in the bucket/blocking/init.py module.

The errors are in the "file_versions" and "file_names" methods.

Instead of using NextFilename as an attribute of the file object, one must use "fileName"; also, the "nextFileId" returns a typeError.

Sincerely,

How can I upload the failed files again?

When I use asyncio to upload dozens of files concurrently, the following errors often occur. I use Ubuntu system. How can I upload the failed files again?
`uploadtasks = [bucket.upload_file(UploadSettings(channelid + "/" + singlepath.name),singlepath) for singlepath in collectpath if singlepath]

filemodel, waittingfile = await asyncio.wait(uploadtasks)

print("WWWWWWWaiting", waittingfile)

if not waittingfile:
return True`

Traceback (most recent call last): File "/home/ubuntu/.local/lib/python3.10/site-packages/backblaze/bucket/awaiting/__init__.py", line 213, in upload_file data, file = await self.upload( File "/home/ubuntu/.local/lib/python3.10/site-packages/backblaze/bucket/awaiting/__init__.py", line 240, in upload file = FileModel(await self._context._post( File "/home/ubuntu/.local/lib/python3.10/site-packages/backblaze/http/awaiting.py", line 55, in _post return await self.__handle( File "/home/ubuntu/.local/lib/python3.10/site-packages/backblaze/http/awaiting.py", line 25, in __handle resp = await request(*args, **kwargs) File "/home/ubuntu/.local/lib/python3.10/site-packages/httpx/_client.py", line 1789, in post return await self.request( File "/home/ubuntu/.local/lib/python3.10/site-packages/httpx/_client.py", line 1483, in request response = await self.send( File "/home/ubuntu/.local/lib/python3.10/site-packages/httpx/_client.py", line 1571, in send response = await self._send_handling_auth( File "/home/ubuntu/.local/lib/python3.10/site-packages/httpx/_client.py", line 1599, in _send_handling_auth response = await self._send_handling_redirects( File "/home/ubuntu/.local/lib/python3.10/site-packages/httpx/_client.py", line 1636, in _send_handling_redirects response = await self._send_single_request(request) File "/home/ubuntu/.local/lib/python3.10/site-packages/httpx/_client.py", line 1673, in _send_single_request response = await transport.handle_async_request(request) File "/home/ubuntu/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 270, in handle_async_request with map_httpcore_exceptions(): File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__ self.gen.throw(typ, value, traceback) File "/home/ubuntu/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 79, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectError Task exception was never retrieved future: <Task finished name='Task-449' coro=<AwaitingBucket.upload_file() done, defined at /home/ubuntu/.local/lib/python3.10/site-packages/backblaze/bucket/awaiting/__init__.py:177> exception=ConnectError('')> Traceback (most recent call last): File "/home/ubuntu/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 62, in map_httpcore_exceptions yield File "/home/ubuntu/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 276, in handle_async_request ) = await self._pool.handle_async_request( File "/home/ubuntu/.local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 234, in handle_async_request response = await connection.handle_async_request( File "/home/ubuntu/.local/lib/python3.10/site-packages/httpcore/_async/connection.py", line 136, in handle_async_request self.socket = await self._open_socket(timeout) File "/home/ubuntu/.local/lib/python3.10/site-packages/httpcore/_async/connection.py", line 163, in _open_socket return await self._backend.open_tcp_stream( File "/home/ubuntu/.local/lib/python3.10/site-packages/httpcore/_backends/auto.py", line 44, in open_tcp_stream return await self.backend.open_tcp_stream( File "/home/ubuntu/.local/lib/python3.10/site-packages/httpcore/_backends/anyio.py", line 147, in open_tcp_stream with map_exceptions(exc_map): File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__ self.gen.throw(typ, value, traceback) File "/home/ubuntu/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions raise to_exc(exc) from None httpcore.ConnectError

Problems in deleting a AwaitingFile from bucket

Dear developers,

I have noticed that it is not so easy to delete a given bucket's file (a.k.a., an AwaitingFile object) from BackBlaze.

It seems that the AwaitingFile does not have a filename as an attribute that could be easily assessed for invoking its inherent "delete" method.

Therefore, if possible, I believe that the method "delete" from the AwaitingFile object could be reformulated in such a way that no "filename" is required from the user. This parameter should be directly accessible as an attribute of the class' instance. After all, it is of common understanding that the file to be deleted is itself, and not some other file; thus, no name should be required for its own deletion from Backblaze.

Let me know your thoughts.

sincerely,

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.