Commit 880ac095 authored by Roland Haas's avatar Roland Haas
Browse files

add endpoint_autoactivate helper

parent 6488c81b
......@@ -131,6 +131,26 @@ class GlobusTransferHelper:
"""Return the globus TransferClient object used"""
return self.tclient
def endpoint_autoactivate(self, endpoint, interactive=True):
"""present URL to activate an endpoint if needed
Input:
endpoint - globus endpoint UUID on which files should be deleted
interactive - show dialog if needed (default: True)
Returns:
True if activation succeeded
"""
r = self.tclient.endpoint_autoactivate(endpoint, if_expires_in=24*3600)
while (r["code"] == "AutoActivationFailed"):
if(interactive):
print("Endpoint requires manual activation, please open "
"the following URL in a browser to activate the "
"endpoint:")
print("https://app.globus.org/file-manager?origin_id=%s"
% endpoint)
self.input("Press ENTER after activating the endpoint:")
r = self.tclient.endpoint_autoactivate(endpoint, if_expires_in=24*3600)
return r["code"].startswith("AutoActivated")
# transfer API helpers
def task_wait(self, result):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment