BaseClient#
All service clients support the low level interface, provided by the
BaseClient
, from which all client types inherit.
A client object contains a transport
, an object responsible for sending
requests, encoding data, and handling potential retries. It also may include an
optional authorizer
, an object responsible for handling token
authentication for requests.
BaseClient#
- class globus_sdk.BaseClient(*, environment: str | None = None, base_url: str | None = None, authorizer: GlobusAuthorizer | None = None, app_name: str | None = None, transport_params: dict[str, Any] | None = None)[source]#
Abstract base class for clients with error handling for Globus APIs.
- Parameters:
authorizer (
GlobusAuthorizer
) – AGlobusAuthorizer
which will generate Authorization headersapp_name (str) – Optional “nice name” for the application. Has no bearing on the semantics of client actions. It is just passed as part of the User-Agent string, and may be useful when debugging issues with the Globus Team
transport_params (dict) – Options to pass to the transport for this client
All other parameters are for internal use and should be ignored.
- scopes: ScopeBuilder | None = None#
the scopes for this client may be present as a
ScopeBuilder
- get(path: str, *, query_params: dict[str, Any] | None = None, headers: dict[str, str] | None = None) GlobusHTTPResponse [source]#
Make a GET request to the specified path.
See
request()
for details on the various parameters.- Returns:
GlobusHTTPResponse
object
- post(path: str, *, query_params: dict[str, Any] | None = None, data: None | str | Dict[str, Any] | PayloadWrapper = None, headers: dict[str, str] | None = None, encoding: str | None = None) GlobusHTTPResponse [source]#
Make a POST request to the specified path.
See
request()
for details on the various parameters.- Returns:
GlobusHTTPResponse
object
- delete(path: str, *, query_params: dict[str, Any] | None = None, headers: dict[str, str] | None = None) GlobusHTTPResponse [source]#
Make a DELETE request to the specified path.
See
request()
for details on the various parameters.- Returns:
GlobusHTTPResponse
object
- put(path: str, *, query_params: dict[str, Any] | None = None, data: None | str | Dict[str, Any] | PayloadWrapper = None, headers: dict[str, str] | None = None, encoding: str | None = None) GlobusHTTPResponse [source]#
Make a PUT request to the specified path.
See
request()
for details on the various parameters.- Returns:
GlobusHTTPResponse
object
- patch(path: str, *, query_params: dict[str, Any] | None = None, data: None | str | Dict[str, Any] | PayloadWrapper = None, headers: dict[str, str] | None = None, encoding: str | None = None) GlobusHTTPResponse [source]#
Make a PATCH request to the specified path.
See
request()
for details on the various parameters.- Returns:
GlobusHTTPResponse
object
- request(method: str, path: str, *, query_params: dict[str, Any] | None = None, data: None | str | Dict[str, Any] | PayloadWrapper = None, headers: dict[str, str] | None = None, encoding: str | None = None, allow_redirects: bool = True, stream: bool = False) GlobusHTTPResponse [source]#
Send an HTTP request
- Parameters:
method (str) – HTTP request method, as an all caps string
path (str) – Path for the request, with or without leading slash
query_params (dict, optional) – Parameters to be encoded as a query string
headers (dict) – HTTP headers to add to the request
data (dict or str) – Data to send as the request body. May pass through encoding.
encoding (str) – A way to encode request data. “json”, “form”, and “text” are all valid values. Custom encodings can be used only if they are registered with the transport. By default, strings get “text” behavior and all other objects get “json”.
allow_redirects (bool) – Follow Location headers on redirect response automatically. Defaults to
True
stream (bool) – Do not immediately download the response content. Defaults to
False
- Returns:
GlobusHTTPResponse
object- Raises:
GlobusAPIError – a GlobusAPIError will be raised if the response to the request is received and has a status code in the 4xx or 5xx categories