Low Level API

All service clients support the low level interface, provided by the BaseClient.

class globus_sdk.base.BaseClient(service, environment=None, base_url=None, base_path=None, authorizer=None, app_name=None)[source]

Simple client with error handling for Globus REST APIs. Implemented as a wrapper around a requests.Session object, with a simplified interface that does not directly expose anything from requests.

You should never try to directly instantiate a BaseClient.

Parameters

authorizer (GlobusAuthorizer)

A GlobusAuthorizer which will generate Authorization headers
app_name (string)
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

All other parameters are for internal use and should be ignored.

set_app_name(app_name)[source]

Set an application name to send to Globus services as part of the User Agent.

Application developers are encouraged to set an app name as a courtesy to the Globus Team, and to potentially speed resolution of issues when interacting with Globus Support.

get(path, params=None, headers=None, response_class=None, retry_401=True)[source]

Make a GET request to the specified path.

Parameters

path (string)
Path for the request, with or without leading slash
params (dict)
Parameters to be encoded as a query string
headers (dict)
HTTP headers to add to the request
response_class (class)
Class for response object, overrides the client’s default_response_class
retry_401 (bool)
Retry on 401 responses with fresh Authorization if self.authorizer supports it
Returns:GlobusHTTPResponse object
post(path, json_body=None, params=None, headers=None, text_body=None, response_class=None, retry_401=True)[source]

Make a POST request to the specified path.

Parameters

path (string)
Path for the request, with or without leading slash
params (dict)
Parameters to be encoded as a query string
headers (dict)
HTTP headers to add to the request
json_body (dict)
Data which will be JSON encoded as the body of the request
text_body (string or dict)
Either a raw string that will serve as the request body, or a dict which will be HTTP Form encoded
response_class (class)
Class for response object, overrides the client’s default_response_class
retry_401 (bool)
Retry on 401 responses with fresh Authorization if self.authorizer supports it
Returns:GlobusHTTPResponse object
delete(path, params=None, headers=None, response_class=None, retry_401=True)[source]

Make a DELETE request to the specified path.

Parameters

path (string)
Path for the request, with or without leading slash
params (dict)
Parameters to be encoded as a query string
headers (dict)
HTTP headers to add to the request
response_class (class)
Class for response object, overrides the client’s default_response_class
retry_401 (bool)
Retry on 401 responses with fresh Authorization if self.authorizer supports it
Returns:GlobusHTTPResponse object
put(path, json_body=None, params=None, headers=None, text_body=None, response_class=None, retry_401=True)[source]

Make a PUT request to the specified path.

Parameters

path (string)
Path for the request, with or without leading slash
params (dict)
Parameters to be encoded as a query string
headers (dict)
HTTP headers to add to the request
json_body (dict)
Data which will be JSON encoded as the body of the request
text_body (string or dict)
Either a raw string that will serve as the request body, or a dict which will be HTTP Form encoded
response_class (class)
Class for response object, overrides the client’s default_response_class
retry_401 (bool)
Retry on 401 responses with fresh Authorization if self.authorizer supports it
Returns:GlobusHTTPResponse object