def login(toolingapi_settings, session_id_expired): if "access_token" not in globals() or session_id_expired: result = soap_login(toolingapi_settings) globals()["access_token"] = result["session_id"] globals()["instance_url"] = result["instance_url"] globals()["server_url"] = result["server_url"] globals()["user_id"] = result["user_id"]
def login(self, session_id_expired): if self.username not in globals() or session_id_expired: result = soap_login(self.toolingapi_settings) # If login succeed, display error and return False if result["status_code"] > 399: util.sublime_error_message(result) return False result["headers"] = { "Authorization": "OAuth " + result["session_id"], "Content-Type": "application/json; charset=UTF-8", "Accept": "application/json" } globals()[self.username] = result return True