feat: upload images with keep-alive #772
Merged
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.
This pull request refactors the API v4 authentication and HTTP request logic to streamline session management, improve code clarity, and make upload worker configuration more flexible. The main changes include replacing custom HTTP request handling with a shared
http.Session
, updating authentication flows to use session objects, and introducing a configurable number of upload workers.API and HTTP session refactoring:
api_v4.py
, replacing them with newcreate_user_session
andcreate_client_session
helpers that return pre-configuredhttp.Session
objects for authenticated requests. All API methods now accept a session object instead of raw tokens. [1] [2] [3] [4]http
module, updating all usages accordingly. [1] [2]Authentication flow updates:
authenticate.py
to use the new session-based API, ensuring all requests are made through properly configured session objects. [1] [2] [3]Upload worker configuration:
--num_upload_workers
CLI argument to allow users to specify the number of concurrent upload workers, with a new default value.These changes improve maintainability, security, and configurability of the upload and authentication processes.