Picovico Modules

Base

class picovico.PicovicoAPI(app_id, device_id=None, app_secret=None)

Picovico-SDK: The API class. Base class for API activity. It will ready component and project objects based on authorization.

photo_component

PicovicoPhoto instance.

video_component

PicovicoVideo instance.

music_component

PicovicoMusic instance.

style_component

PicovicoStyle instance.

project

PicovicoProject instance.

Note

Components and Projects are available only after authorization.

Parameters:
  • app_id (str) – Application ID given by Picovico.
  • device_id (str) – Some Device identifier. [Default will be used]
  • app_secret (str) – Optional If application secret is given.
login(username, password)

API login method. Calls login action on API and sets access headers. Also, it readies the component attributes if everything ok.

Parameters:
  • username (str) – Picovico login username.
  • password (str) – Picovico login password.
authenticate(app_secret=None)

API authentication workflow.

This is application secret based authentication. This also sets access headers and readies components.

Parameters:app_secret (str) – Application Secret provided by Picovico.
me(*args, **kwargs)

Get my profile.

access_key

Read-Only Access Key.

access_token

Read-Only Access Token.

app_id

Read-Only Application ID provided during initiation.

app_secret

Read-Only Application Secret.

device_id

Device Idetifier to be used.

headers

Header dict based on is_authorized else None.

is_anonymous()

Check if key and token are set. This should be opposite of is_authorized.

Returns:True if access_key and access_token is set else False.
Return type:bool
is_authorized()

Check if key and token are set.

Returns:False if is_anonymous else True.
Return type:bool
logout()

Flush access key and token.

set_access_tokens(access_key, access_token)

Set access_key and access_token for authentication

Parameters:
  • access_key (str) – access key provided by picovico
  • access_token (str) – access token provided by picovico

Submodules

picovico.baserequest module

class picovico.baserequest.PicovicoRequest(headers=None)

Picovico-SDK: Picovico Request class for API calls.

This class is a convenience wrapper around requests module. It provides method calls and arguments for Picovico API. This also include URL buildup.

Parameters:headers (dict) – Optional headers to be included with API request.
host

The base host URL. By default its provided by picovico.

url

The URL created using host and path.

headers

The header that is provided in init along with appends for additional headers.

is_authenticated()

Checks whether the object is authenticated or not.

This method checks for header for authentication token and key.

Returns:True if header consist of authentication headers else False.
Return type:bool
get(path)

Request get method.

Parameters:

path (str) – URL path.

Raises:
Returns:

json data.

Return type:

dict

post(path, post_data=None)

Request post method.

Parameters:
  • path (str) – URL path.
  • post_data (dict) – Optional Data to be posted {‘k’: ‘v’} format.
Raises:
Returns:

json data.

Return type:

dict

put(path, filename=None, data_headers=None)

Request put method.

Parameters:
  • path (str) – URL path.
  • filename (str) – Optional filename with full path.
  • data_headers (dict) – Optional Data to be posted {‘k’: ‘v’} format.
Raises:
Returns:

json data.

Return type:

dict

delete(path)

Request put method.

Parameters:

path (str) – URL path.

Raises:
Returns:

json data.

Return type:

dict

picovico.decorators module

picovico.decorators.pv_auth_required(func)

Picovico-SDK: Authentication necessity decorator.

This decorator checks for object methods such as is_authorized and is_authenticated. It is mostly used with component and api class. Also it sets header to _pv_request attribute of the object.

Raises:PicovicoAPINotAllowed
picovico.decorators.pv_not_implemented(against)

Picovico-SDK: Checks Implementation.

Used in component class to check if the object component is implemented in API or not.

Parameters:againsts (list | tuple) – The check itertor.
Raises:NotImplementedError
picovico.decorators.pv_project_check_begin(func)

Picovico-SDK: Check Project Initiation.

This checks project object video attribute.

Raises:PicovicoProjectNotAllowed

picovico.exceptions module

exception picovico.exceptions.PicovicoRequestError(status=400, message=None, response=None)

Picovico-SDK: Class for all the client related request errors.

This class is raised when the response from server is not related to 200 or 300 and 500 status.

exception picovico.exceptions.PicovicoNotFound(message=None, response=None)

Picovico-SDK: Error for 404 status.

exception picovico.exceptions.PicovicoUnauthorized(message=None, response=None)

Picovico-SDK: Error for 401 status.

This error is raised when there is fault in access-token and access-key scenario. i.e. Authentication problems.

exception picovico.exceptions.PicovicoServerError(status=500, message=None, response=None)

Picovico-SDK: Same as PicovicoRequestError.

This is raised for status codes of 500 i.e. server related errors.

exception picovico.exceptions.PicovicoAPINotAllowed

Picovico-SDK: Helper class for API errors.

This class is raised when there is some api related thresholds.

exception picovico.exceptions.PicovicoComponentNotSupported

Picovico-SDK: Helper class for component errors.

This is raised when user sets component that is not yet supported.

exception picovico.exceptions.PicovicoProjectNotAllowed

Picovico-SDK: Project related error class.

This is raised when there is some assertions in project methods.

picovico.exceptions.raise_valid_error(**error_response)

Picovico-SDK: Exception raising helper. Raises valid errors according to status_code provided.

Parameters:

status_code (int) – HTTP status code either from response itself or provided explicitly.

Raises:

picovico.project module

picovico.project.Vdd

Video Data Definition to be used in project All video related components are stored in Vdd

alias of VideoDefinitionData

class picovico.project.PicovicoProject(request_obj)

Picovico-SDK: Project class.

This class is a helper for stateful video creation process. The object will hold all component related actions as well.

photo_component

PicovicoPhoto instance.

video_component

PicovicoVideo instance.

music_component

PicovicoMusic instance.

style_component

PicovicoStyle instance.

Parameters:request_obj (PicovicoRequest) – Request object with authentication
Raises:PicovicoProjectNotAllowed – when request_obj is not authorized.
vdd

Read-only Vdd instance.

video

Read-only video identifier from project initiation.

begin(name=None)

Initiate the video proect.

Parameters:name (str) – Optional Name of video or default ‘Untitled’ name
discard()

Discard current project if set.

save()

Save Vdd component.

render()

Render/Create the video.

preview()

Preview the video.

populate_vdd()

Make Vdd post data.

Returns:data based on Vdd instance.
Return type:dict
static time_counter(assets)

Time counter. Appends time in assets.

Returns:data with ‘start_time’ and ‘end_time’.
Return type:dict
static create_asset_dict(asset_type, asset_id=None, data=None)

Asset data creator. Creates asset post data from asset type.

Parameters:
  • asset_type (str) – name of asset to be sent.
  • asset_id (str) – Optional id of some asset component
  • data (dict) – Optional additional data to be sent.
Returns:

Single Asset post data.

Return type:

dict

set_style(*args, **kwargs)

Add style to video project. Sets Vdd style.

Parameters:value (str) – style name of picovico.
Raises:AssertionError
set_quality(*args, **kwargs)

Add quality to video project. Sets Vdd quality.

Parameters:value (int) – allowed quality by picovico
Raises:AssertionError
set_name(value)

Add name to video project. Sets Vdd name.

Parameters:value (str) – name to set.
add_music(*args, **kwargs)

Add music to video project. Adds music asset to Vdd.

Parameters:music_id (str) – music identifier from picovico.
set_privacy(*args, **kwargs)

Set privacy of video project.

Parameters:value (str) – value of allowed privacy.
add_credit(*args, **kwargs)

Add single credit to video project. Credits are list of length 2.

Parameters:
  • name (str) – first credit value
  • value (str) – second credit value
add_text(*args, **kwargs)

Add text asset to video project.

Parameters:
  • title (str) – title of text asset
  • body (str) – body of text asset that coheres with title
Raises:

AssertionError

add_photo(*args, **kwargs)

Add photo asset to video project.

Parameters:
  • photo_id (str) – photo identifier from picovico
  • caption (str) – caption to be used with photo.
add_music_url(url, preview=None)

Set music from URL and preview. Calls upload url then sets identifier as music asset.

Parameters:
  • url (str) – URL of music
  • preview (optional[str]) – Preview URL of music.
add_music_file(filename)

Set music from file. Calls upload file and then sets identifier in music asset.

Parameters:filename (str) – filname path.
add_photo_url(url, thumbnail=None, caption=None)

Set photo asset from url. Calls upload_url and then sets identifier in photo asset.

Parameters:
  • url (str) – URL of photo to upload.
  • thumbnail (optional[str]) – thumbnail URL of photo.
  • caption (optional[str]) – caption to be used in photo.
add_photo_file(filename, caption=None)

Set photo asset from file. Calls upload file and then sets identifier in photo asset.

Parameters:
  • filename (str) – path of file.
  • caption (optional[str]) – caption to be used in photo.
clear_assets(*args, **kwargs)

Clear video project vdd assets.

clear_credits(*args, **kwargs)

Clear video project credit assets.

picovico.urls module

All the api related endpoints and host.

picovico.urls.PICOVICO_BASE = 'https://uapi-f1.picovico.com/v2.1/'

Base URL