We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RegionRestriction
Currently if the RegionRestriction object exists for a video, it is expected to have both fields (allowed, blocked).
allowed
blocked
python-youtube/pyyoutube/models/video.py
Lines 32 to 33 in 7076d19
But some video only have 1 set while the other is None, resulting in this error:
None
{project_root}/.venv/lib/site-packages/dataclasses_json/core.py:184: RuntimeWarning: `NoneType` object value of non-optional type allowed detected when decoding RegionRestriction.
From my understanding both fields should be marked as optional, like this:
allowed: Optional[List[str]] = field(default=None) blocked: Optional[List[str]] = field(default=None, repr=False)
The ideal way would probably be to somehow define that at least 1 of the 2 is needed and the other is optional. But I don't think that is possible.
The text was updated successfully, but these errors were encountered:
Yes, This need to add Optional
Optional
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Problem
Currently if the
RegionRestriction
object exists for a video, it is expected to have both fields (allowed
,blocked
).python-youtube/pyyoutube/models/video.py
Lines 32 to 33 in 7076d19
But some video only have 1 set while the other is
None
,resulting in this error:
Solution
From my understanding both fields should be marked as optional,
like this:
The ideal way would probably be to somehow define that at least 1 of the 2 is needed and the other is optional.
But I don't think that is possible.
The text was updated successfully, but these errors were encountered: