Skip to main content

Python client library for Bitcasa API

Project description

Getting started

How to Build

You must have Python 2 >=2.7.9 or Python 3 >=3.4 installed on your system to install and run this SDK. This SDK package depends on other Python packages like nose, jsonpickle etc. These dependencies are defined in the requirements.txt file that comes with the SDK. To resolve these dependencies, you can use the PIP Dependency manager. Install it by following steps at https://pip.pypa.io/en/stable/installing/.

Python and PIP executables should be defined in your PATH. Open command prompt and type pip --version. This should display the version of the PIP Dependency Manager installed if your installation was successful and the paths are properly defined.

  • Using command line, navigate to the directory containing the generated files (including requirements.txt) for the SDK.
  • Run the command pip install -r requirements.txt. This should install all the required dependencies.

Building SDK - Step 1

How to Use

The following section explains how to use the ApiTesterUploadTest SDK package in a new project.

1. Open Project in an IDE

Open up a Python IDE like PyCharm. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.

Open project in PyCharm - Step 1

Click on Open in PyCharm to browse to your generated SDK directory and then click OK.

Open project in PyCharm - Step 2

The project files will be displayed in the side bar as follows:

Open project in PyCharm - Step 3

2. Add a new Test Project

Create a new directory by right clicking on the solution name as shown below:

Add a new project in PyCharm - Step 1

Name the directory as "test"

Add a new project in PyCharm - Step 2

Add a python file to this project with the name "testsdk"

Add a new project in PyCharm - Step 3

Name it "testsdk"

Add a new project in PyCharm - Step 4

In your python file you will be required to import the generated python library using the following code lines

from api_tester_upload_test.api_tester_upload_test_client import ApiTesterUploadTestClient

Add a new project in PyCharm - Step 4

After this you can write code to instantiate an API client object, get a controller object and make API calls. Sample code is given in the subsequent sections.

3. Run the Test Project

To run the file within your test project, right click on your Python file inside your Test project and click on Run

Run Test Project - Step 1

How to Test

You can test the generated SDK and the server with automatically generated test cases. unittest is used as the testing framework and nose is used as the test runner. You can run the tests as follows:

  1. From terminal/cmd navigate to the root directory of the SDK.
  2. Invoke pip install -r test-requirements.txt
  3. Invoke nosetests

Initialization

Authentication

In order to setup authentication and initialization of the API client, you need the following information.

Parameter Description
account_id TODO: add a description
o_auth_access_token OAuth 2.0 Access Token

API client can be initialized as following.

# Configuration parameters and credentials
account_id = 'TODO Add Value for parameter...'
o_auth_access_token = 'o_auth_access_token' # OAuth 2.0 Access Token

client = ApiTesterUploadTestClient(account_id, o_auth_access_token)

Class Reference

List of Controllers

Class: AuthenticationOperationsController

Get controller instance

An instance of the AuthenticationOperationsController class can be accessed from the API Client.

 authentication_operations_controller = client.authentication_operations

Method: get_ping

TODO: Add a method description

def get_ping(self,
                 authorization)

Parameters

Parameter Tags Description
authorization Required Bearer

Example Usage

authorization = 'Authorization'

authentication_operations_controller.get_ping(authorization)

Method: create_o_auth_2_password_credentials_grant

TODO: Add a method description

def create_o_auth_2_password_credentials_grant(self,
                                                   authorization,
                                                   date,
                                                   username,
                                                   password)

Parameters

Parameter Tags Description
authorization Required BCS :
date Required TODO: Add a parameter description
username Required TODO: Add a parameter description
password Required TODO: Add a parameter description

Example Usage

authorization = 'Authorization'
date = datetime.now()
username = 'username'
password = 'password'

result = authentication_operations_controller.create_o_auth_2_password_credentials_grant(authorization, date, username, password)

Back to List of Controllers

Class: FoldersOperationsController

Get controller instance

An instance of the FoldersOperationsController class can be accessed from the API Client.

 folders_operations_controller = client.folders_operations

Method: delete_folder

TODO: Add a method description

def delete_folder(self,
                      path,
                      commit=None,
                      force=None)

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description
commit Optional TODO: Add a parameter description
force Optional TODO: Add a parameter description

Example Usage

path = 'path'
commit = 'commit'
force = 'force'

result = folders_operations_controller.delete_folder(path, commit, force)

Method: list_folder

TODO: Add a method description

def list_folder(self,
                    path=None,
                    depth=None,
                    filter=None,
                    strict_traverse=None)

Parameters

Parameter Tags Description
path Optional TODO: Add a parameter description
depth Optional TODO: Add a parameter description
filter Optional TODO: Add a parameter description
strictTraverse Optional TODO: Add a parameter description

Example Usage

path = 'path'
depth = 'depth'
filter = 'filter'
strict_traverse = 'strict-traverse'

result = folders_operations_controller.list_folder(path, depth, filter, strict_traverse)

Method: create_move_folder

TODO: Add a method description

def create_move_folder(self,
                           path,
                           to,
                           name,
                           exists=None)

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description
to Required TODO: Add a parameter description
name Required TODO: Add a parameter description
exists Optional TODO: Add a parameter description

Example Usage

path = 'path'
to = 'to'
name = 'name'
exists = ExistsEnum.FAIL

result = folders_operations_controller.create_move_folder(path, to, name, exists)

Method: create_copy_folder

TODO: Add a method description

def create_copy_folder(self,
                           path,
                           to,
                           name,
                           exists=None)

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description
to Required TODO: Add a parameter description
name Required TODO: Add a parameter description
exists Optional TODO: Add a parameter description

Example Usage

path = 'path'
to = 'to'
name = 'name'
exists = ExistsEnum.FAIL

result = folders_operations_controller.create_copy_folder(path, to, name, exists)

Method: get_folder_meta

TODO: Add a method description

def get_folder_meta(self,
                        path)

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description

Example Usage

path = 'path'

result = folders_operations_controller.get_folder_meta(path)

Method: create_folder

TODO: Add a method description

def create_folder(self,
                      path,
                      name,
                      exists=None)

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description
name Required TODO: Add a parameter description
exists Optional TODO: Add a parameter description

Example Usage

path = 'path'
name = 'name'
exists = ExistsEnum.FAIL

result = folders_operations_controller.create_folder(path, name, exists)

Method: alter_folder_meta

TODO: Add a method description

def alter_folder_meta(self,
                          operation,
                          name,
                          version,
                          version_conflict,
                          path=None,
                          date_created=None,
                          date_meta_last_modified=None,
                          date_content_last_modified=None,
                          application_data=None)

Parameters

Parameter Tags Description
operation Required TODO: Add a parameter description
name Required TODO: Add a parameter description
version Required TODO: Add a parameter description
versionConflict Required TODO: Add a parameter description
path Optional TODO: Add a parameter description
dateCreated Optional TODO: Add a parameter description
dateMetaLastModified Optional TODO: Add a parameter description
dateContentLastModified Optional TODO: Add a parameter description
applicationData Optional TODO: Add a parameter description

Example Usage

operation = 'operation'
name = 'name'
version = 11
version_conflict = 'version-conflict'
path = 'path'
date_created = datetime.now()
date_meta_last_modified = datetime.now()
date_content_last_modified = datetime.now()
application_data = { }

result = folders_operations_controller.alter_folder_meta(operation, name, version, version_conflict, path, date_created, date_meta_last_modified, date_content_last_modified, application_data)

Back to List of Controllers

Class: TrashOperationsController

Get controller instance

An instance of the TrashOperationsController class can be accessed from the API Client.

 trash_operations_controller = client.trash_operations

Method: delete_trash_items

TODO: Add a method description

def delete_trash_items(self,
                           path)

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description

Example Usage

path = 'path'

trash_operations_controller.delete_trash_items(path)

Method: get_browse_trash

TODO: Add a method description

def get_browse_trash(self,
                         path)

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description

Example Usage

path = 'path'

result = trash_operations_controller.get_browse_trash(path)

Method: create_recover_trash_items

TODO: Add a method description

def create_recover_trash_items(self,
                                   path,
                                   restore=None,
                                   rescue_path=None,
                                   recreate_path=None)

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description
restore Optional TODO: Add a parameter description
rescuePath Optional TODO: Add a parameter description
recreatePath Optional TODO: Add a parameter description

Example Usage

path = 'path'
restore = 'restore'
rescue_path = 'rescue-path'
recreate_path = 'recreate-path'

trash_operations_controller.create_recover_trash_items(path, restore, rescue_path, recreate_path)

Back to List of Controllers

Class: HistoryOperationsController

Get controller instance

An instance of the HistoryOperationsController class can be accessed from the API Client.

 history_operations_controller = client.history_operations

Method: list_history

TODO: Add a method description

def list_history(self,
                     start=None,
                     stop=None)

Parameters

Parameter Tags Description
start Optional TODO: Add a parameter description
stop Optional TODO: Add a parameter description

Example Usage

start = 11
stop = 11

result = history_operations_controller.list_history(start, stop)

Back to List of Controllers

Class: ShareOperationsController

Get controller instance

An instance of the ShareOperationsController class can be accessed from the API Client.

 share_operations_controller = client.share_operations

Method: create_unlock_share

TODO: Add a method description

def create_unlock_share(self,
                            share_key,
                            password)

Parameters

Parameter Tags Description
shareKey Required TODO: Add a parameter description
password Required TODO: Add a parameter description

Example Usage

share_key = 'share_key'
password = 'password'

result = share_operations_controller.create_unlock_share(share_key, password)

Method: create_receive_share

TODO: Add a method description

def create_receive_share(self,
                             share_key,
                             path=None,
                             exists=None)

Parameters

Parameter Tags Description
shareKey Required TODO: Add a parameter description
path Optional TODO: Add a parameter description
exists Optional TODO: Add a parameter description

Example Usage

share_key = 'share_key'
path = 'path'
exists = ExistsEnum.FAIL

result = share_operations_controller.create_receive_share(share_key, path, exists)

Method: delete_share

TODO: Add a method description

def delete_share(self,
                     share_key)

Parameters

Parameter Tags Description
shareKey Required TODO: Add a parameter description

Example Usage

share_key = 'share_key'

share_operations_controller.delete_share(share_key)

Method: alter_share_info

TODO: Add a method description

def alter_share_info(self,
                         share_key,
                         current_password=None,
                         password=None,
                         name=None)

Parameters

Parameter Tags Description
shareKey Required TODO: Add a parameter description
currentPassword Optional TODO: Add a parameter description
password Optional TODO: Add a parameter description
name Optional TODO: Add a parameter description

Example Usage

share_key = 'share_key'
current_password = 'current_password'
password = 'password'
name = 'name'

result = share_operations_controller.alter_share_info(share_key, current_password, password, name)

Method: get_browse_share

TODO: Add a method description

def get_browse_share(self,
                         share_key,
                         path=None)

Parameters

Parameter Tags Description
shareKey Required TODO: Add a parameter description
path Optional TODO: Add a parameter description

Example Usage

share_key = 'share_key'
path = 'path'

result = share_operations_controller.get_browse_share(share_key, path)

Method: create_share

TODO: Add a method description

def create_share(self,
                     path)

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description

Example Usage

path = 'path'

result = share_operations_controller.create_share(path)

Method: list_shares

TODO: Add a method description

def list_shares(self)

Example Usage

result = share_operations_controller.list_shares()

Back to List of Controllers

Class: AdministratorsOperationsController

Get controller instance

An instance of the AdministratorsOperationsController class can be accessed from the API Client.

 administrators_operations_controller = client.administrators_operations

Method: create_account

TODO: Add a method description

def create_account(self,
                       authorization,
                       date,
                       username,
                       password,
                       email=None,
                       first_name=None,
                       last_name=None)

Parameters

Parameter Tags Description
authorization Required BCS client_application_id:request_signature
date Required TODO: Add a parameter description
username Required TODO: Add a parameter description
password Required TODO: Add a parameter description
email Optional TODO: Add a parameter description
firstName Optional TODO: Add a parameter description
lastName Optional TODO: Add a parameter description

Example Usage

authorization = 'Authorization'
date = datetime.now()
username = 'username'
password = 'password'
email = 'email'
first_name = 'first_name'
last_name = 'last_name'

result = administrators_operations_controller.create_account(authorization, date, username, password, email, first_name, last_name)

Back to List of Controllers

Class: FileOperationsController

Get controller instance

An instance of the FileOperationsController class can be accessed from the API Client.

 file_operations_controller = client.file_operations

Method: list_file_versions

TODO: Add a method description

def list_file_versions(self,
                           path,
                           start_version=None,
                           stop_version=None,
                           limit=None)

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description
startVersion Optional TODO: Add a parameter description
stopVersion Optional TODO: Add a parameter description
limit Optional TODO: Add a parameter description

Example Usage

path = 'path'
start_version = 11
stop_version = 11
limit = 11

result = file_operations_controller.list_file_versions(path, start_version, stop_version, limit)

Method: create_move_file

TODO: Add a method description

def create_move_file(self,
                         path,
                         to,
                         name=None,
                         exists=None)

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description
to Required TODO: Add a parameter description
name Optional TODO: Add a parameter description
exists Optional TODO: Add a parameter description

Example Usage

path = 'path'
to = 'to'
name = 'name'
exists = ExistsEnum.FAIL

result = file_operations_controller.create_move_file(path, to, name, exists)

Method: create_copy_file

TODO: Add a method description

def create_copy_file(self,
                         path,
                         to,
                         name,
                         exists='rename')

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description
to Required TODO: Add a parameter description
name Required TODO: Add a parameter description
exists Optional DefaultValue TODO: Add a parameter description

Example Usage

path = 'path'
to = 'to'
name = 'name'
exists = ExistsEnum.RENAME

result = file_operations_controller.create_copy_file(path, to, name, exists)

Method: get_download_file

TODO: Add a method description

def get_download_file(self,
                          path,
                          range=None,
                          version=None,
                          version_conflict=None)

Parameters

Parameter Tags Description
path Required Base64-encoded path to any location in the authenticated user�s account.
range Optional TODO: Add a parameter description
version Optional TODO: Add a parameter description
versionConflict Optional TODO: Add a parameter description

Example Usage

path = 'path'
range = 'Range'
version = 11
version_conflict = 'version-conflict'

file_operations_controller.get_download_file(path, range, version, version_conflict)

Errors

Error Code Error Description
400 Version was not supplied, or version was not the current version.

Method: create_promote_file_version

TODO: Add a method description

def create_promote_file_version(self,
                                    path,
                                    version)

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description
version Required TODO: Add a parameter description

Example Usage

path = 'path'
version = 11

result = file_operations_controller.create_promote_file_version(path, version)

Method: get_file_meta

TODO: Add a method description

def get_file_meta(self,
                      path)

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description

Example Usage

path = 'path'

result = file_operations_controller.get_file_meta(path)

Method: list_single_file_version

TODO: Add a method description

def list_single_file_version(self,
                                 path,
                                 version)

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description
version Required TODO: Add a parameter description

Example Usage

path = 'path'
version = 11

result = file_operations_controller.list_single_file_version(path, version)

Method: delete_file

TODO: Add a method description

def delete_file(self,
                    path,
                    commit='false')

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description
commit Optional DefaultValue TODO: Add a parameter description

Example Usage

path = 'path'
commit = 'false'

result = file_operations_controller.delete_file(path, commit)

Method: create_after_file_meta

TODO: Add a method description

def create_after_file_meta(self,
                               path,
                               name=None,
                               extension=None,
                               date_created=None,
                               date_meta_last_modified=None,
                               date_content_last_modified=None,
                               mime=None,
                               application_data=None,
                               version=None,
                               version_conflict=None)

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description
name Optional TODO: Add a parameter description
extension Optional TODO: Add a parameter description
dateCreated Optional TODO: Add a parameter description
dateMetaLastModified Optional TODO: Add a parameter description
dateContentLastModified Optional TODO: Add a parameter description
mime Optional TODO: Add a parameter description
applicationData Optional TODO: Add a parameter description
version Optional TODO: Add a parameter description
versionConflict Optional TODO: Add a parameter description

Example Usage

path = 'path'
name = 'name'
extension = 'extension'
date_created = datetime.now()
date_meta_last_modified = datetime.now()
date_content_last_modified = datetime.now()
mime = 'mime'
application_data = { }
version = 11
version_conflict = 'version-conflict'

result = file_operations_controller.create_after_file_meta(path, name, extension, date_created, date_meta_last_modified, date_content_last_modified, mime, application_data, version, version_conflict)

Back to List of Controllers

Class: CreateAccountController

Get controller instance

An instance of the CreateAccountController class can be accessed from the API Client.

 create_account_controller = client.create_account

Method: create_account

create new user

def create_account(self,
                       date,
                       username,
                       password,
                       authorization,
                       email=None,
                       first_name=None,
                       last_name=None)

Parameters

Parameter Tags Description
date Required TODO: Add a parameter description
username Required TODO: Add a parameter description
password Required TODO: Add a parameter description
authorization Required BCS client_application_id:request_signature
email Optional TODO: Add a parameter description
firstName Optional TODO: Add a parameter description
lastName Optional TODO: Add a parameter description

Example Usage

date = datetime.now()
username = 'username'
password = 'password'
authorization = 'Authorization'
email = 'email'
first_name = 'first_name'
last_name = 'last_name'

result = create_account_controller.create_account(date, username, password, authorization, email, first_name, last_name)

Back to List of Controllers

Class: UserOperationsController

Get controller instance

An instance of the UserOperationsController class can be accessed from the API Client.

 user_operations_controller = client.user_operations

Method: upload_file

TODO: Add a method description

def upload_file(self,
                    path,
                    file,
                    exists=None,
                    reuse_attributes=None,
                    reuse_fallback=None)

Parameters

Parameter Tags Description
path Required TODO: Add a parameter description
file Required TODO: Add a parameter description
exists Optional TODO: Add a parameter description
reuseAttributes Optional TODO: Add a parameter description
reuseFallback Optional TODO: Add a parameter description

Example Usage

path = 'path'
file = open("pathtofile", 'rb')
exists = ExistsEnum.FAIL
reuse_attributes = 'reuse-attributes'
reuse_fallback = 'reuse-fallback'

result = user_operations_controller.upload_file(path, file, exists, reuse_attributes, reuse_fallback)

Method: get_profile

TODO: Add a method description

def get_profile(self)

Example Usage

result = user_operations_controller.get_profile()

Back to List of Controllers

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

api-tester-upload-test-1.1.71.tar.gz (35.6 kB view hashes)

Uploaded Source

Built Distribution

api_tester_upload_test-1.1.71-py3-none-any.whl (69.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page