Skip to content

Commit

Permalink
Merge pull request #48 from cehbrecht/issue-47-ssl-error
Browse files Browse the repository at this point in the history
added bootstrap option to examples
  • Loading branch information
cehbrecht committed Aug 21, 2019
2 parents 37d20fe + dd91fb7 commit 8bd6e6f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
29 changes: 24 additions & 5 deletions notebooks/examples/logon.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
"## 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": {},
Expand All @@ -26,29 +38,36 @@
"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)\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."
"**NOTE**: you may be prompted for your username if not available via your OpenID.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Obtain MyProxy credentials from your username, password and the MyProxy host:"
"Obtain MyProxy credentials from the MyProxy host in *interactive* mode asking you for *username* and *password*:"
]
},
{
Expand All @@ -58,15 +77,15 @@
"outputs": [],
"source": [
"myproxy_host = 'esgf-data.dkrz.de'\n",
"lm.logon(username=None, password=None, hostname=myproxy_host)\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."
"**NOTE**: See the ``pyesgf.logon`` module documentation for details of how to use myproxy username instead of OpenID."
]
}
],
Expand Down
6 changes: 4 additions & 2 deletions pyesgf/logon.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,23 @@
>>> lm = LogonManager()
>>> lm.is_logged_on()
False
>>> lm.logon(username, password, myproxy_hostname)
>>> lm.logon(username, password, myproxy_hostname, bootstrap=True)
>>> lm.is_logged_on()
True
Logon parameters that aren't specified will be prompted for at the terminal
by default. The :class:`LogonManager` object also writes a ``.httprc`` file
configuring OPeNDAP access through the NetCDF API.
The option ``bootstrap=True`` is needed on the first run.
You can use your OpenID to logon instead. The logon details will be deduced
from the OpenID where possible::
>>> lm.logoff()
>>> lm.is_logged_on()
False
>>> lm.logon_with_openid(openid, password)
>>> lm.logon_with_openid(openid, password, bootstrap=True)
>>> lm.is_logged_on()
True
Expand Down

0 comments on commit 8bd6e6f

Please sign in to comment.