Unless noted otherwise, all method return values for Globus SDK Clients are GlobusHTTPResponse objects.

To customize client methods with additional detail, the SDK uses subclasses of GlobusHTTPResponse.

class globus_sdk.response.GlobusHTTPResponse(response: Union[requests.models.Response, GlobusHTTPResponse], client: Optional[globus_sdk.BaseClient] = None)[source]

Bases: object

Response object that wraps an HTTP response from the underlying HTTP library. If the response is JSON, the parsed data will be available in data, otherwise data will be None and text should be used instead.

The most common response data is a JSON dictionary. To make handling this type of response as seamless as possible, the GlobusHTTPResponse object implements the immutable mapping protocol for dict-style access. This is just an alias for access to the underlying data.

If the response data is not a dictionary or list, item access will raise TypeError.

>>> print("Response ID": r["id"]) # alias for["id"]

client – The client instance which made the request

get(key: str, default: Optional[Any] = None) Any[source]

get is just an alias for data.get(key, default), but with the added check that if data is None, it returns the default.

property headers: Mapping[str, str]

The HTTP response headers as a case-insensitive mapping.

For example, headers["Content-Length"] and headers["content-length"] are treated as equivalent.

property http_reason: str

The HTTP reason string from the response.

This is the part of the status line after the status code, and typically is a string description of the status. If the status line is HTTP/1.1 200 OK, then this is the string "OK".

property http_status: int

The HTTP response status, as an integer.

property text: str

The raw response data as a string.

class globus_sdk.response.IterableResponse(response: Union[requests.models.Response, GlobusHTTPResponse], client: Optional[globus_sdk.BaseClient] = None, *, iter_key: Optional[str] = None)[source]

Bases: globus_sdk.response.GlobusHTTPResponse

This response class adds an __iter__ method on an ‘iter_key’ variable. The assumption is that iter produces dicts or dict-like mappings.