This sample application demonstrates how you may upload a video file to Panopto by using Panopto Upload API and Panotpo OAuth2 authorization.
- You need Panopto user account who can create a video on Panopto system. If you don't have it, ask your organization's Panopto administrator.
- If you do not have Python 3 on your system, install the latest stable version from https://python.org
- Install external modules for this application.
pip install requests oauthlib requests_oauthlib
pip install boto3
- Sign in to Panopto web site
- Click your name in right-upper corner, and clikc "User Settings"
- Select "API Clients" tab
- Click "Create new API Client" button
- Enter arbitrary Client Name
- Select Server-side Web Application type.
- Enter
https://localhost
into CORS Origin URL. - Enter
http://localhost:9127/redirect
into Redirect URL. - The rest can be blank. Click "Create API Client" button.
- Note the created Client ID and Client Secret.
- Navigate to the target folder on Panopto web site
- Click gear icon at the top-right corner.
- Select Manage tab
- Find Folder ID and note it.
Assuming you have test.mp4 in the current directly, type the following command.
python upload.py --server your.site.panopto.com --folder-id [Folder ID] --upload-file test.mp4 --client-id [Client ID] --client-secret [Client Secret]
You will see the sign-in screen on the browser for the first time. Go through sign in process. Once it's done, the file should be uploaded and the command monitors the progress until server side process is done.
If you run this script for the second time, you do not need to go to sign-in screen because this sample application has saved OAuth2 refresh token in *.cache file.
Type python upload.py --help
for more command line options.
This sample application intentionally does not include error handling or retry logic in order to focus on the usage of API. As the best practice, you should have both proper error handling and reasonable retry logic in production code.
It is useful to capture the actual network traffic by the capture tool, like Fiddler on Windows and Charles on Mac, and examine it.
You should pass --skip-verify
option for that purpose, so that the appliation ignore SSL ceritificate replaced by such tool and continue to run.
UCS XML file may provide various additional metadata to construct a complicated Panopto video session. You may find the full spec as XSD file. You may modify upload_manifest_template.xml file in this example and experiment how it works.
- Panopto support document: How to Upload Files Using the API
- Panopto support document: Create OAuth2 Clients
- Universal Content Library specification: UCS XML definition and samples.
- Requests-OAuthlib: Python module to handle OAuth2 workflow on top of OAuthlib library
- Requests: HTTP library for Python