Search in sources :

Example 1 with IpnbSettings

use of org.jetbrains.plugins.ipnb.configuration.IpnbSettings in project intellij-community by JetBrains.

the class IpnbConnection method authorizeAndGetKernel.

private String authorizeAndGetKernel(@NotNull Project project, @NotNull String pathToFile, @NotNull String loginUrl) throws IOException {
    IpnbSettings ipnbSettings = IpnbSettings.getInstance(project);
    final String username = ipnbSettings.getUsername();
    String cookies = login(username, ipnbSettings.getPassword(myProject.getLocationHash()), loginUrl);
    myHeaders.put(SM.COOKIE, cookies);
    if (myIsHubServer) {
        if (myXsrf == null) {
            initXSRF(myURI.toString() + USER_PATH + "/" + username + TREE_PATH);
        }
        final Boolean started = startJupyterNotebookServer(username);
        if (!started) {
            throw new IOException(CANNOT_START_JUPYTER);
        }
    }
    final String kernelName = getDefaultKernelName();
    return getExistingKernelForSession(pathToFile, kernelName);
}
Also used : IpnbSettings(org.jetbrains.plugins.ipnb.configuration.IpnbSettings)

Aggregations

IpnbSettings (org.jetbrains.plugins.ipnb.configuration.IpnbSettings)1