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¶ PicovicoPhotoinstance.
- 
video_component¶ PicovicoVideoinstance.
- 
music_component¶ PicovicoMusicinstance.
- 
style_component¶ PicovicoStyleinstance.
- 
project¶ PicovicoProjectinstance.
Note
Components and Projects are available only after authorization.
Parameters: - 
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: 
- 
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 
Check if key and token are set.
Returns: False if is_anonymous else True. Return type: bool 
- 
logout()¶ Flush access key and token.
- 
 
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: PicovicoNotFound– If status is 404.PicovicoUnauthorized– If status is 401.PicovicoRequestError– If status is 400 related.PicovicoServerError– If status is 500.
Returns: jsondata.Return type: 
- 
post(path, post_data=None)¶ Request post method.
Parameters: Raises: PicovicoNotFound– If status is 404.PicovicoUnauthorized– If status is 401.PicovicoRequestError– If status is 400 related.PicovicoServerError– If status is 500.AssertionError– when post_data is notdict.
Returns: jsondata.Return type: 
- 
put(path, filename=None, data_headers=None)¶ Request put method.
Parameters: Raises: PicovicoNotFound– If status is 404.PicovicoUnauthorized– If status is 401.PicovicoRequestError– If status is 400 related.PicovicoServerError– If status is 500.AssertionError– when filename or data_headers are provided but donot match the types.
Returns: jsondata.Return type: 
- 
delete(path)¶ Request put method.
Parameters: path (str) – URL path.
Raises: PicovicoNotFound– If status is 404.PicovicoUnauthorized– If status is 401.PicovicoRequestError– If status is 400 related.PicovicoServerError– If status is 500.
Returns: jsondata.Return type: 
- 
 
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.
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.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¶ PicovicoPhotoinstance.
- 
video_component¶ PicovicoVideoinstance.
- 
music_component¶ PicovicoMusicinstance.
- 
style_component¶ PicovicoStyleinstance.
Parameters: request_obj (PicovicoRequest) – Request object with authentication Raises: PicovicoProjectNotAllowed– when request_obj is not authorized.- 
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.
- 
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: Returns: Single Asset post data.
Return type: 
- 
set_style(*args, **kwargs)¶ Add style to video project. Sets
Vddstyle.Parameters: value (str) – style name of picovico. Raises: AssertionError
- 
set_quality(*args, **kwargs)¶ Add quality to video project. Sets
Vddquality.Parameters: value (int) – allowed quality by picovico Raises: AssertionError
- 
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: 
- 
add_text(*args, **kwargs)¶ Add text asset to video project.
Parameters: Raises: AssertionError
- 
add_photo(*args, **kwargs)¶ Add photo asset to video project.
Parameters: 
- 
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.
-