feat: Add Min-Server-Version header support#50
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces support for enforcing a minimum server version by adding a Min-Server-Version header to all API requests.
- Sets a default
"Min-Server-Version": "3.6.0"header in the client session - Does not yet provide a way to customize or test this header behavior
Comments suppressed due to low confidence (2)
src/codeocean/client.py:41
- Currently the header is always sent; to match the description, allow clients to opt in by adding a constructor argument or setter so the header is only included when explicitly requested.
"Min-Server-Version": "3.6.0",
src/codeocean/client.py:39
- No tests cover the new
Min-Server-Versionheader; add unit tests to verify that the header is set correctly and that invalid formats are handled as expected.
self.session.headers.update({
ramdayan
approved these changes
Jul 11, 2025
| agent_id: Optional[str] = None | ||
|
|
||
| # Minimum server version required by this SDK | ||
| MIN_SERVER_VERSION = "3.6.0" |
Contributor
Author
There was a problem hiding this comment.
Fair question.
Putting the new optional headers support aside, this is the system version that this SDK supports.
I didn't want to prevent users from using the latest SDK (0.8.0 that we'll release) with CO v3.6.0
There was a problem hiding this comment.
Since the version is not checked in all CO versions so far it doesn't really matter so I guess it's fine, but we can also check when was the last change to the API and pin the correlating version. Up to you.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Code Ocean API now supports enforcing minimum server version requirements through the
Min-Server-Versionheader. When a client specifies this header, the server will validate that its version meets the minimum requirement before processing the request. When the server version is insufficient or the header format is invalid, the API returns 400 Bad Request.