The official python sdk library is made available via PyPi

Installation

pip install picovico

Functions

Following helpers functions are available via the SDK Library.

authenticate

  • for authentication with APP_ID, APP_SECRET and DEVICE_ID
  • initialize the API before authenticating

authenticated_api

  • for authenticated API calls

anonymous_api

  • for anonymous API calls

text_slide

  • basic helper to generate payload json for text slide

image_slide

  • basic helper to generate payload json for image slide

Getting Started

# necessary imports
from __future__ import print_functionimport json
from picovico.exceptions import PicovicoError
from picovico import PicovicoAPI2 as PicovicoAPI
# authentication credentials
APP_ID = ''
APP_SECRET = ''
DEVICE_ID = ''
# initialize
pv = PicovicoAPI(APP_ID, APP_SECRET, DEVICE_ID)
pv.authenticate()
# payload definition
payload = {
   "style" : "vanilla_frameless",
   "quality" : 360,
   "name" : "Sample Video",
   "aspect_ratio" : "16:9",
   "assets" : [
      {
        "music" : {"id" : "aud_6j44J9zjbSQe54ZTTSqUj2" },
        "frames" : {
            pv.text_slide(title="You are", body="my love"),
            pv.text_slide(title="You are", body="CSS to my HTML"),
            pv.image_slide(image_url="https://images.unsplash.com/photo-1481326086332-e77dd61a4ea1"),
            pv.text_slide(title="You", body="make me complete")
         }
      }
  ]
}
# make the api call
try:
    res = pv.authenticated_api(method='post',
                               url='me/videos',
                               json.dumps(payload),
                               headers={
                                   'Content-Type': 'application/json',
                                   'Accept': 'application/json'
                               })
except PicovicoError as e:
    print(str(e))
else:
    print(res)
Did this answer your question?