Version 1.1 - Updated on 11/17/2016
Cloud(client\_key, client\_secret, callback\_url [, access\_token [, refresh\_token [, on\_refreshed ]]]
The Python SDK Personal Cloud Storage class. For most applications, you there is one instance of this class for each user.
client_key
— Key obtained from the ThingSpace portalclient_secret
— Secret obtained from the ThingSpace portalcallback_url
— Callback URL obtained from the ThingSpace portal.access_token
- Optional OAuth 2.0 access token that allows the SDK to immediately begin making authenticated calls.refresh_token
- Optional OAuth 2.0 refresh token.on_refreshed
— Callback function you can use to refresh tokens. Passes the Token
object as the only argument.cloud.authorize_url()
Obtains a URL used to start the OAuth 2.0 authorization flow. The URI prompts the users to log on and grant access to their Personal Cloud Storage content.
cloud.refresh()
Called when an OAuth 2.0 access token expires. Uses a refresh token to obtain a new access token. This call fails if the refresh token has expired.
This method id called internally by the SDK, when an expired access token is detected.
Token
object containing the access\_token
and the refresh\_token
.CloudError
— HTTP request failureUnauthorizedError
— The user provided a bad or expired refresh token.cloud.token(auth_code)
The second part of the standard OAuth 2.0 authorization flow. Uses an authorization code obtained through the OAuth 2.0 redirect_uri
to obtain an access and refresh tokens, used to access an user’s Cloud Storage content.
auth_code
— OAuth 2.0 auth code obtained from the callback.Token
object containing the access\_token
and refresh\_token
. The SDK may begin making authenticated calls after a successful tokens call.CloudError
— HTTP request failureUnauthorizedError
— The user provided a bad auth\_code
.cloud.account()
Retrieves the account information.
Account
object containing a user’s quota usage and id.CloudError
— HTTP request failureUnauthorizedError
— Unauthorized, bad or expired token.cloud.download\_url(file_or_path)
Retrieves a download URL for a CloudFile
object
file_or_path
— a CloudFile
or the path of the file to be downloaded.cloud.file_metadata(path)
Retrieves metadata for a file.
path
— Path to the fileCloudFile
containing the metadata of the fileCloudError
— HTTP request failureUnauthorizedError
— Unauthorized, bad or expired tokenNotFoundError
- The resource was not found.cloud.fullview(etag)
Obtains information on all files and folders in a user’s Personal Cloud Storage account.
Return value contains a property etag
. Use etag
as an argument to a fullview
call to retrieve changes between two subsequent fullview
calls.
etag
— Lucene style search queryfiles
- array of CloudFile
objectsempty_folders
- Array of empty CloudFolder
Objects in the user’s cloudetag
- Etag
used in subsequent fullview
calls to retrieve the changes to the content of a user’s Personal Cloud Storage accountdeleted
- Array of paths that have been deleted since the last fullview callCloudError
— HTTP request failureUnauthorizedError
— Unauthorized, bad or expired tokenOutOfSyncError
- Specified etag
is too far out of date. Delete cached files and resync by calling fullview
without etag
.cloud.metadata(path)
Retrieves the metadata for a folder. The response includes the metadata for the folder’s contents, including files and subfolders.
path
— Current folder’s path and name. Defaults to the root /
.files
- array of CloudFile
objectsfolders
- array of CloudFolder
objectsCloudError
— HTTP request failureUnauthorizedError
— Unauthorized, bad or expired tokenNotFoundError
- The resource was not found.cloud.search(query [, sort [, virtualfolder [, page [, count]]]])
Searches for files or folders.
query
— Lucene style search querysort
- Optional sort parameter. Syntax is: {field}+{asc or desc}
.virtualfolder
- Optional virtualfolder to search in. Default is VZMOBILE
.page
- Optional page number. Default is 1.count
- Optional number of results to return. Default is 20, max is 100.files
- array of CloudFile
objectsfolders
- array of CloudFolder
objectsCloudError
— HTTP request failureUnauthorizedError
— Unauthorized, bad or expired tokencloud.upload(file\_or\_path, upload\_path [, name [, chunked [, chunk_size ]]])
Uploads a file.
file_or_path
— Either a file object or a path from where the file is to be uploaded.upoad_path
- Path where the file is to be uploaded toname
- Optional. New name of the file, defaults to the current name.chunked
- Optional. If set to true, forces smaller files to be uploaded in chunks.chunk_size
- Optional chunk size in bytes.CloudFile
object containing metadata of the uploaded fileCloudError
— HTTP request failureUnauthorizedError
— Unauthorized, bad or expired tokenCopyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.