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.
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.
Click on Open
in PyCharm to browse to your generated SDK directory and then click OK
.
The project files will be displayed in the side bar as follows:
2. Add a new Test Project
Create a new directory by right clicking on the solution name as shown below:
Name the directory as "test"
Add a python file to this project with the name "testsdk"
Name it "testsdk"
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
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
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:
- From terminal/cmd navigate to the root directory of the SDK.
- Invoke
pip install -r test-requirements.txt
- 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
- AuthenticationOperationsController
- FoldersOperationsController
- TrashOperationsController
- HistoryOperationsController
- ShareOperationsController
- AdministratorsOperationsController
- FileOperationsController
- CreateAccountController
- UserOperationsController
AuthenticationOperationsController
Get controller instance
An instance of the AuthenticationOperationsController
class can be accessed from the API Client.
authentication_operations_controller = client.authentication_operations
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)
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)
FoldersOperationsController
Get controller instance
An instance of the FoldersOperationsController
class can be accessed from the API Client.
folders_operations_controller = client.folders_operations
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)
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)
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)
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)
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)
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)
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)
TrashOperationsController
Get controller instance
An instance of the TrashOperationsController
class can be accessed from the API Client.
trash_operations_controller = client.trash_operations
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)
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)
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)
HistoryOperationsController
Get controller instance
An instance of the HistoryOperationsController
class can be accessed from the API Client.
history_operations_controller = client.history_operations
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)
ShareOperationsController
Get controller instance
An instance of the ShareOperationsController
class can be accessed from the API Client.
share_operations_controller = client.share_operations
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)
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)
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)
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)
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)
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)
list_shares
TODO: Add a method description
def list_shares(self)
Example Usage
result = share_operations_controller.list_shares()
AdministratorsOperationsController
Get controller instance
An instance of the AdministratorsOperationsController
class can be accessed from the API Client.
administrators_operations_controller = client.administrators_operations
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 |
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)
FileOperationsController
Get controller instance
An instance of the FileOperationsController
class can be accessed from the API Client.
file_operations_controller = client.file_operations
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)
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)
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)
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. |
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)
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)
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)
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)
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)
CreateAccountController
Get controller instance
An instance of the CreateAccountController
class can be accessed from the API Client.
create_account_controller = client.create_account
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 |
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)
UserOperationsController
Get controller instance
An instance of the UserOperationsController
class can be accessed from the API Client.
user_operations_controller = client.user_operations
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)
get_profile
TODO: Add a method description
def get_profile(self)
Example Usage
result = user_operations_controller.get_profile()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for api-tester-upload-test-1.1.71.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11edbf30392fdb00f83442c9dc72212d461ed93c448c27d79342231fc5d0ac97 |
|
MD5 | 8f81fce3d245a43ab3b2e4288a7f4671 |
|
BLAKE2b-256 | c936435d307d00b868957428de570f57245d0526df20acf5cbc7ca1dfba103dd |
Hashes for api_tester_upload_test-1.1.71-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff0a1fc1b380e1d03e1d4aefca056e23e3812d474bbc73005b2fa4dc9526a0f7 |
|
MD5 | e769abf67b6a75df54bec0557b4ca807 |
|
BLAKE2b-256 | c81a066087ea348b0f610a899ef5603a2f7cbd92749aeb19c506b0d5d15b978b |