Skip to content

add timeout#14

Open
vidiecan wants to merge 2 commits intodtqfrom
add_timeout
Open

add timeout#14
vidiecan wants to merge 2 commits intodtqfrom
add_timeout

Conversation

@vidiecan
Copy link

No description provided.

Copilot AI review requested due to automatic review settings February 24, 2026 11:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a timeout parameter to the api_post method in the DSpace REST client, allowing callers to specify a timeout value for POST requests. The timeout is properly propagated through all recursive retry calls that handle CSRF token refresh and authentication failures.

Changes:

  • Added optional timeout parameter to the api_post method signature
  • Passed the timeout parameter to the underlying session.post() call
  • Ensured timeout is propagated through all retry paths
Comments suppressed due to low confidence (2)

dspace_rest_client/client.py:221

  • The timeout parameter has been added to api_post but not to other similar HTTP methods in the client. The methods api_get (line 204), api_put (line 296), api_delete (line 328), api_patch (line 359), and api_post_uri (line 266) all make HTTP requests but do not support timeout configuration. For consistency and to allow timeout control across all HTTP operations, consider adding the timeout parameter to these methods as well. This would provide users with uniform control over request timeouts regardless of the HTTP verb being used.
    def api_post(self, url, params, json, retry=False, timeout=None):

dspace_rest_client/client.py:230

  • The timeout parameter should be added to the docstring to document its purpose. The docstring currently describes url, params, json, and retry parameters but is missing documentation for the new timeout parameter. Following the pattern of other parameters, add a line like "@param timeout: Optional timeout value in seconds for the POST request".
    def api_post(self, url, params, json, retry=False, timeout=None):
        """
        Perform a POST request. Refresh XSRF token if necessary.
        POSTs are typically used to create objects.
        @param url:     DSpace REST API URL
        @param params:  Any parameters to include (eg ?parent=abbc-....)
        @param json:    Data in json-ready form (dict) to send as POST body (eg. item.as_dict())
        @param retry:   Has this method already been retried? Used if we need to refresh XSRF.
        @return:        Response from API
        """

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants