1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
|
Test
~~~~
.. DANGER::
Beware killer rabbits!
.. note:: This is a note admonition.
This is the second line of the first paragraph.
- The note contains all indented body elements
following.
- It includes this bullet list.
.. admonition:: And, by the way...
You can make up your own admonition too.
.. title:: This is title
block of text
.. admonition:: This is admonition
block of text
.. warning:: This is warning
block of text
.. tip:: This is tip
block of text
.. note:: This is note
block of text
.. important:: This is important
block of text
.. hint:: This is hint
block of text
.. error:: This is error
block of text
.. danger:: This is danger
block of text
.. caution:: This is caution
block of text
.. attention:: This is attention
block of text
.. _semver:
Types of interfaces and version pinning
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
b2sdk is divided into three parts. Please pay attention to which group you use, as the stability of your application depends on correct pinning of versions.
Public
~~~~~~
Public interface consists of *public* members of the following modules:
* b2sdk.api.B2Api
* b2sdk.bucket.Bucket
* b2sdk.exception
* b2sdk.sync
* b2sdk.sync.exception
and some of their dependencies:
* b2sdk._internal.account_info.InMemoryAccountInfo
* b2sdk._internal.account_info.SqliteAccountInfo
* b2sdk.transferer
* b2sdk._internal.utils
Those will not change in a backwards-incompatible way between non-major versions. In other words, if you pin your dependencies to `>=x.0.0;<x+1.0.0`, everything should be ok.
In other words, if you pin your dependencies to
.. example:: If the current version of b2sdk is 4.5.6 and you only use the public interfaces, put this in your requirements.txt:
>=4.5.6;<5.0.0
.. note:: b2sdk.*._something and b2sdk.*.*._something, having a name which begins with an underscore, are NOT considered public interface.
Protected
~~~~~~~~~
Things which sometimes might be necessary to use that are NOT considered public interface (and may change in a non-major version):
* B2Session
* B2RawHTTPApi
* B2Http
.. note:: it is ok for you to use those (better that, than copying our sources), however if you do, please pin your dependencies to middle version.
.. example:: If the current version of b2sdk is 4.5.6 and you use the public and protected interfaces, put this in your requirements.txt:
>=4.5.6;<4.6.0
Private
~~~~~~~
If you need to use some of our private interfaces, pin your dependencies strictly.
.. example:: If the current version of b2sdk is 4.5.6 and you use the private interface, put this in your requirements.txt:
==4.5.6
Authorization
~~~~~~~~~~~~~
Before you can use b2sdk, you need to prove who you are to the server. For that you will need to pass `account id` and `api token` to one of the authorization classes.
In case you are storing that information in a database or something, you can implement your own class by inheriting from AbstractAuthorization. Otherwise, use one of the classes included in b2sdk package:
InMemoryAccountInfo:
This is probably what your application should be using and also what we use in our tests.
SqliteAccountInfo:
this is what B2 CLI uses to authorize the user. Stores information in a local file.
B2Api
~~~~
The "main" object that abstracts the communication with B2 cloud is B2Api. It lets you manage buckets and download files by id.
example
Bucket
~~~~~~
Bucket class abstracts the B2 bucket, which is essentially a namespace for objects.
The best way to transfer your files into a bucket and back, is to use *sync*.
If for some reason you cannot use sync, it is also possible to upload and download files directly into/from the bucket, using Bucket.upload_file and Bucket.download_by_name.
The Bucket object also contains a few methods to list the contents of the bucket and the metadata associated with the objects contained in it.
========
Tutorial
========
Account authorization
=====================
TODO
Bucket actions
==============
Create a bucket
---------------
TODO
Remove a bucket
---------------
TODO
List buckets
-------------
TODO
Update bucket info
------------------
TODO
File actions
============
Upload file
-----------
TODO
Download file
-------------
TODO
List files
----------
TODO
Get file meta information
-------------------------
TODO
Delete file
-----------
TODO
Cancel file operations
----------------------
TODO
Synchronization
===============
TODO
Account information
===================
TODO
|