Skip to content

Conversation

@lennertvandevelde
Copy link
Contributor

No description provided.

@lennertvandevelde lennertvandevelde requested a review from spacid May 5, 2023 09:10
spacid added 6 commits May 22, 2023 11:57
According to the MediaHaven REST API, a POST response can have a different
status than 200 or 204, depending on the resource. For example, creating a
record returns a 201 (Created). For simplicity reasons, just accept everything
between the 200 and 207 range including the boundaries.

Also, adapt the docstring to reflect the reality.
Rename `parent_record_id` to `record_id` and make it the first parameter
to be more consistent with the other methods.

Adapt docstring to reflect the truth.

Autoformat with black. Also, bump black version to fix autoformat on save
in VSCode.
According to the Python documentation:

    "Passing arguments of the wrong type (e.g. passing a list when an int is expected)
    should result in a TypeError, but passing arguments with the wrong value
    (e.g. a number outside expected boundaries) should result in a ValueError."

More specifically for ValueError:

    "Raised when an operation or function receives an argument that has the right type
    but an inappropriate value, and the situation is not described by a more precise
    exception such as IndexError."

Raising a ValueError is more appropriate in this case.
Add tests for `Records.create`.

Add type hints for frames and timecode arguments in the `Records.create`
function.

Change response of `MediaHavenClient._post` to actually return the content
of the body if there is any. Depending on the resource (path), the response
can contain content, for example a post request on the resource `exports`,
returns information of the created export.

Change `media_id` to `record_id` to reflect the signature and/or API path.
@spacid spacid merged commit d9575f0 into main Jun 28, 2023
@spacid spacid deleted the mhpy-15-fragment-creation branch July 11, 2023 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants