{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Examples of pyesgf.logon usage" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**NOTE**: For the logon module you need to install the latest `myproxyclient` from pypi:\n", "```\n", "$ conda create -c conda-forge -n esgf-pyclient python=3.6 pip esgf-pyclient\n", "$ conda activate esgf-pyclient\n", "(esgf-pyclient) pip install myproxyclient\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Obtain MyProxy credentials to allow downloading files or using secured OpenDAP:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from pyesgf.logon import LogonManager\n", "lm = LogonManager()\n", "lm.logoff()\n", "lm.is_logged_on()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**NOTE**: When you run it for the first time you need to set `bootstrap=True`." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "OPENID = 'https://esgf-data.dkrz.de/esgf-idp/openid/USERNAME'\n", "lm.logon_with_openid(openid=OPENID, password=None, bootstrap=True)\n", "lm.is_logged_on()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**NOTE**: you may be prompted for your username if not available via your OpenID.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Obtain MyProxy credentials from the MyProxy host in *interactive* mode asking you for *username* and *password*:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "myproxy_host = 'esgf-data.dkrz.de'\n", "lm.logon(hostname=myproxy_host, interactive=True, bootstrap=True)\n", "lm.is_logged_on()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**NOTE**: See the ``pyesgf.logon`` module documentation for details of how to use myproxy username instead of OpenID." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.3" } }, "nbformat": 4, "nbformat_minor": 4 }