rnag / wystia Goto Github PK
View Code? Open in Web Editor NEWA Python wrapper library for the Wistia API
License: MIT License
A Python wrapper library for the Wistia API
License: MIT License
Consider adding support for the Stats API (link below)
I want to add support for the following endpoints in the Wystia library:
Crashed while running my Wistia upload/HTML dump script, which has worked previously. Code here:
https://github.com/KaneDM/wistia-upload-embed/blob/main/tvid.py
The video was uploaded successfully, and the thumbnail was successfully created and assigned, but something went wrong during the thumbnail assignment.
Crashed on line 83 of my script, where I call WistiaApi.update_video(vidid, thumbnail_media_id=tn.hashed_id)
.
Traceback (most recent call last):
File "D:\Python\tvid.py", line 83, in <module>
WistiaApi.update_video(vidid, thumbnail_media_id=tn.hashed_id)
File "C:\Python311\Lib\site-packages\wystia\api_data.py", line 347, in update_video
return cls.update_media(
^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\wystia\api_data.py", line 396, in update_media
return model_cls.from_dict(r.json())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\dataclass_wizard\loaders.py", line 536, in fromdict
return load(d)
^^^^^^^
File "C:\Python311\Lib\site-packages\dataclass_wizard\loaders.py", line 611, in cls_fromdict
field_name = lookup_field_for_json_key(o, json_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\dataclass_wizard\loaders.py", line 705, in lookup_field_for_json_key
raise e from None
dataclass_wizard.errors.UnknownJSONKey: A JSON key is missing from the dataclass schema for class `Video`.
unknown key: 'tags'
dataclass fields: ['hashed_id', 'id', 'name', 'type', 'created', 'updated', 'duration', 'status', 'description', 'progress', 'thumbnail', 'project', 'embed_code', 'assets', 'section', 'archived', 'has_audio_description', 'captions_enabled', 'overlay_text', 'caption_duration', 'num_captions', 'ad_disabled']
input JSON object: {"id": 113495448, "name": "Blep", "type": "Video", "archived": false, "created": "2023-12-22T19:27:51+00:00", "updated": "2023-12-22T19:27:52+00:00", "duration": 1583.04, "hashed_id": "d8wh65z917", "description": "", "progress": 0.14285714285714285, "status": "queued", "thumbnail": {"url": "https://embed-ssl.wistia.com/deliveries/955004dbcdfd7aef4f136c28c495f0df.jpg?image_crop_resized=200x120&video_still_time=791", "width": 200, "height": 120}, "tags": []}
Appears to be the same kind of problem as issue #59.
New Docs:
https://docs.wistia.com/reference
As Wistia seems to have rehauled their docs page and changed link + added new API routes, I'd like to update library to stay abreast of that. By updating methods under API classes to add new methods to call those routes. Also add test cases if possible.
Attempted to upload a video to Wistia using a script I wrote that has worked in the past. Wystia crashed because the "UploadResponse" class didn't have a way to handle the "archived" key in the JSON returned from the Wistia API.
Fixed it by adding "archived" keys to the "UploadResponse" and "Video" classes in model.py.
Line 244 (Video class):
archived: bool | None = None
Line 744 (UploadResponse class):
archived: bool
Initial crash traceback:
Traceback (most recent call last):
File "D:\Python\tvid.py", line 65, in <module>
vidupload = WistiaUploadApi.upload_file(vidlatest, project, vidname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\wystia\api_upload.py", line 74, in upload_file
return UploadResponse.from_dict(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\dataclass_wizard\loaders.py", line 536, in fromdict
return load(d)
^^^^^^^
File "C:\Python311\Lib\site-packages\dataclass_wizard\loaders.py", line 611, in cls_fromdict
field_name = lookup_field_for_json_key(o, json_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\dataclass_wizard\loaders.py", line 705, in lookup_field_for_json_key
raise e from None
dataclass_wizard.errors.UnknownJSONKey: A JSON key is missing from the dataclass schema for class `UploadResponse`.
unknown key: 'archived'
dataclass fields: ['hashed_id', 'id', 'name', 'type', 'description', 'account_id', 'created', 'updated', 'progress', 'thumbnail', 'duration', 'status']
input JSON object: {"id": 102354918, "name": "RT Wire Lengths", "type": "Video", "archived": false, "created": "2023-03-17T15:35:37+00:00", "updated": "2023-03-17T15:35:37+00:00", "duration": 1199.032022, "hashed_id": "malb60y0o2", "description": "", "progress": 0.125, "status": "queued", "thumbnail": {"url": "https://embed-ssl.wistia.com/deliveries/a3b1fbd6df17258c467c27207d45a1c5.jpg?image_crop_resized=200x120&video_still_time=599", "width": 200, "height": 120}, "account_id": 392724}
It seems that Wistia continuously adds new endpoints to the Data API, or else modifies payloads etc.
Question, is it possible to come up with an automated way to detect such updates/changes, and be notified of it -- via email, or likewise?
I'd like to run a GH Actions script that detects changes or new additions to the API, and then notify me via email periodically, say once a week.
For example, here are some endpoints that are new and which this library currently doesn't support, on account of them being added quite recently:
It would be nice to be notified or find a way to stay up to date of new additions to the API, so that the library can be similarly updated to support those endpoints.
The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.
Consider adding support for Project Sharings section in the Data API:
https://wistia.com/support/developers/data-api#project-sharings
Our company has currently been working with a 3rd party provider (Editshare) for our video editing workflow. There is a centralized all-in-one (AIO) Linux server set up as part of the workflow that we have running on EC2. As part of the automations hosted on this server, one of them is an automation script I've set up that will leverage the Wistia API to automatically upload video files on our local EBS volumes (which is used by our video editing team) to our Wistia account.
Right now I've hard-coded a custom implementation of the Wistia Upload API in the script I have running on the server, since I'm unable to import the wystia
helper library (which requires Python 3.7 or higher)
Our Linux AIO server has both Python 2 and 3 installed, however the Python 3 version is fixed at v3.5.2
. Our team currently doesn't have sudo permissions to upgrade the Python 3 version. I also checked with one of the Editshare team members we are working with, and they confirmed that we don't want to upgrade the Python 3 version because their application might be using scripts that rely on the specific Python version.
To summarize, it'd be great to update this library to support Python versions as far back as 3.5 (by extension that will also add Python 3.6 to the list of supported versions, which is a nice bonus). Personally, the main use case will be so that the automation script which lives on the Linux server (which is limited to use Python 3.5) can import the wystia
helper library without any issues, and is able to upload large (>2GB) video files to our video hosting platform of choice, i.e. Wistia, via the WistiaUploadApi
helper class.
pip install wystia==0.2.1 # the install by itself does succeed without errors
# This import fails due to Python 3.6+ specific code being used in the library -- that includes
# f-strings, dataclasses, basically all the nice-to-have features :)
from wystia import WistiaUploadApi
As Python 3.6 and 3.7 have already past their EOL, I would like to drop library support for those python versions.
Additionally, I will like to add support for Python 3.12 which just released a while back.
Links:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.