Module Expr Str Import alias Import alias identifier Import alias Import alias ImportFrom alias Import alias Import alias ImportFrom alias TryExcept body ImportFrom alias Import alias Assign NameStore NameLoad handlers ExceptHandler type NameLoad body Assign NameStore NameLoad ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Str Str Assign NameStore Str Assign NameStore Str Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Str Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str ClassDef bases NameLoad body Expr Str Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str If UnaryOpNot NameLoad body Raise Call NameLoad Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body If UnaryOpNot Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return AttributeLoad NameLoad attr orelse With Call NameLoad AttributeLoad NameLoad attr NameStore body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr NameLoad If Call AttributeLoad NameLoad attr body Return AttributeLoad NameLoad attr Return AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam defaults body Return CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad body Expr Str Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad keyword NameLoad keyword NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad body Expr Str If NameLoad body If CompareIs NameLoad NameLoad body Print Str Assign NameStore Call NameLoad If CompareIs NameLoad NameLoad body Print Str Assign NameStore Call NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad BinOpMod Str NameLoad If CompareIn NameLoad TupleLoad NameLoad NameLoad NameLoad body Raise Call NameLoad Str Assign NameStore Call NameLoad keyword NameLoad keyword AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad keyword NameLoad With Call NameLoad AttributeLoad NameLoad attr Str NameStore body For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If NameLoad body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr BinOpMod Str NameLoad For NameStore NameLoad body TryExcept body Assign NameStore AttributeLoad Call AttributeLoad NameLoad attr BinOpMod Str NameLoad attr handlers ExceptHandler type NameLoad body Continue If CompareEq NameLoad NameLoad body Assign NameStore AttributeLoad Call AttributeLoad NameLoad attr BinOpMod Str NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If NameLoad body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Num If CompareIsNot NameLoad NameLoad body Assert CompareEq Call NameLoad NameLoad Num Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr With Call NameLoad AttributeLoad NameLoad attr Str NameStore body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr keyword IfExp NameLoad Num Num keyword IfExp NameLoad Num Num keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If CompareIs NameLoad NameLoad body If UnaryOpNot Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return TupleLoad Str Str Str Assign NameStore Call AttributeLoad Call NameLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad NameLoad AttributeLoad NameLoad attr If CompareLt Call NameLoad NameLoad Num body Assign TupleStore NameStore NameStore NameStore TupleLoad SubscriptLoad NameLoad Index Num Str Str orelse If CompareEq Call NameLoad NameLoad Num body Assign TupleStore NameStore NameStore NameStore BinOpAdd NameLoad ListLoad Str orelse If CompareEq Call NameLoad NameLoad Num body Assign TupleStore NameStore NameStore NameStore NameLoad orelse Assign TupleStore NameStore NameStore TupleLoad ListLoad ListLoad Expr Call AttributeLoad NameLoad attr While NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr If NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad Str attr SubscriptLoad NameLoad Slice Num Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore SubscriptLoad NameLoad Index Num Return TupleLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list decorator_list
N/A N/A 

Module :mod:`pyesgf.logon`
==========================

Manage the client's interaction with ESGF's security system.  Using this module requires installing the MyProxyClient_ library.

.. _MyProxyClient: http://pypi.python.org/pypi/MyProxyClient

To obtain ESGF credentials create a :class:`LogonManager` instance and supply it with logon
details::

  >>> lm = LogonManager()
  >>> lm.is_logged_on()
  False
  >>> lm.logon(username, password, myproxy_hostname)
  >>> 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.

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.is_logged_on()
  True

 N/A os N/A os.path op N/A datetime N/A shutil xml.etree ElementTree N/A urllib2 N/A re getpass getpass N/A N/A myproxy.client MyProxyClient N/A OpenSSL N/A _has_myproxy True N/A N/A N/A ImportError N/A N/A _has_myproxy False exceptions OpenidResolutionError N/A ESGF_DIR N/A N/A op join N/A N/A os environ N/A HOME .esg N/A ESGF_CERTS_DIR certificates N/A ESGF_CREDENTIALS credentials.pem N/A DAP_CONFIG N/A N/A op join N/A N/A os environ N/A HOME .dodsrc N/A DAP_CONFIG_MARKER <<< Managed by esgf-pyclient >>> N/A XRI_NS xri://$xrd*($v*2.0) N/A MYPROXY_URN urn:esg:security:myproxy-service N/A ESGF_OPENID_REXP https://.*/esgf-idp/openid/(.*) N/A MYPROXY_URI_REXP socket://([^:]*):?(\d+)? LogonManager N/A object N/A N/A 
    Manages ESGF crendentials and security configuration files.

    Also integrates with NetCDF's secure OPeNDAP configuration.
    
     N/A STATE_LOGGED_ON 0 N/A STATE_NO_CREDENTIALS 1 N/A STATE_EXPIRED_CREDENTIALS 2 N/A STATE_INVALID_CREDENTIALS 3 __init__ N/A N/A self esgf_dir dap_config N/A ESGF_DIR DAP_CONFIG N/A N/A 
        :param esgf_dir: Root directory of ESGF state.  Default ~/.esg
        :param dap_config: Set the location of .httprc.  Defaults to ~/.httprc

        Note if dap_config is defined your current working directory must be the
        same as the location as the dap_config file when OPeNDAP is initiallised.

         N/A N/A _has_myproxy N/A N/A N/A ImportError pyesgf.logon requires MyProxyClient N/A N/A self esgf_dir esgf_dir N/A N/A self esgf_credentials N/A N/A op join N/A self esgf_dir ESGF_CREDENTIALS N/A N/A self esgf_certs_dir N/A N/A op join N/A self esgf_dir ESGF_CERTS_DIR N/A N/A self dap_config dap_config N/A N/A N/A self _write_dap_config N/A state N/A N/A self N/A N/A N/A N/A N/A N/A op exists N/A self esgf_credentials N/A N/A N/A self STATE_NO_CREDENTIALS N/A N/A N/A open N/A self esgf_credentials fh N/A N/A data N/A N/A fh read N/A cert N/A N/A N/A OpenSSL crypto load_certificate N/A N/A OpenSSL SSL FILETYPE_PEM data N/A N/A N/A cert has_expired N/A N/A N/A self STATE_EXPIRED_CREDENTIALS N/A N/A self STATE_LOGGED_ON N/A property is_logged_on N/A N/A self N/A N/A N/A N/A N/A self state N/A self STATE_LOGGED_ON N/A logon_with_openid N/A N/A self openid password bootstrap update_trustroots interactive N/A None False True True N/A N/A 
        Obtains ESGF credentials by detecting the MyProxy parameters from
        the users OpenID.  Some ESGF compatible OpenIDs do not contain enough
        information to obtain credentials.  In this case the user is prompted
        for missing information if ``interactive == True``, otherwise an
        exception is raised.

        :param openid: OpenID to login with See :meth:`logon` for parameters
            ``interactive``, ``bootstrap`` and ``update_trustroots``.
         N/A N/A username myproxy N/A N/A self _get_logon_details openid N/A N/A N/A self logon username password myproxy bootstrap bootstrap update_trustroots update_trustroots interactive interactive N/A logon N/A N/A self username password hostname bootstrap update_trustroots interactive N/A None None None False True True N/A N/A 
        Obtain ESGF credentials from the specified MyProxy service.

        If ``interactive == True`` then any missing parameters of ``password``,
        ``username`` or ``hostname`` will be prompted for at the terminal.
        
        :param interactive: Whether to ask for input at the terminal for
            any missing information.  I.e. username, password or hostname.
        :param bootstrap: Whether to bootstrap the trustroots for this
            MyProxy service.
        :param update_trustroots: Whether to update the trustroots for this
            MyProxy service.

         N/A interactive N/A N/A N/A hostname None N/A N/A Enter myproxy hostname: N/A hostname N/A raw_input N/A N/A username None N/A N/A Enter myproxy username: N/A username N/A raw_input N/A N/A password None N/A N/A password N/A getpass N/A Enter password for %s:  username N/A N/A None N/A hostname username password N/A N/A N/A OpenidResolutionError Full logon details not available N/A c N/A MyProxyClient hostname hostname caCertDir N/A self esgf_certs_dir N/A creds N/A N/A c logon username password bootstrap bootstrap updateTrustRoots update_trustroots N/A N/A open N/A self esgf_credentials w fh N/A N/A cred creds N/A N/A N/A N/A fh write cred N/A logoff N/A N/A self clear_trustroots N/A False N/A N/A 
        Remove any obtained credentials from the ESGF environment.
        
        :param clear_trustroots: If True also remove trustroots.
    
         N/A N/A N/A op exists N/A self esgf_credentials N/A N/A N/A N/A os remove N/A self esgf_credentials N/A clear_trustroots N/A N/A N/A N/A shutil rmtree N/A self esgf_certs_dir N/A _get_logon_details N/A N/A self openid N/A N/A N/A openid_doc N/A N/A N/A N/A urllib2 urlopen openid read N/A xml N/A N/A ElementTree fromstring openid_doc N/A hostname None N/A port None N/A username None N/A services N/A N/A xml findall N/A .//{%s}Service XRI_NS N/A service services N/A N/A N/A N/A service_type N/A N/A N/A service find N/A {%s}Type XRI_NS text N/A N/A N/A AttributeError N/A N/A N/A N/A service_type MYPROXY_URN N/A N/A myproxy_uri N/A N/A N/A service find N/A {%s}URI XRI_NS text N/A mo N/A N/A re match MYPROXY_URI_REXP myproxy_uri N/A mo N/A N/A N/A hostname port N/A N/A mo groups N/A mo N/A N/A re match ESGF_OPENID_REXP openid N/A mo N/A N/A username N/A N/A mo group 1 N/A N/A port None N/A N/A N/A N/A int port 7512 N/A N/A username hostname N/A _write_dap_config N/A N/A self verbose validate N/A False False N/A N/A N/A preamble managed postamble N/A N/A self _parse_dap_config N/A N/A open N/A self dap_config w fh N/A N/A N/A N/A fh write N/A N/A {preamble}
# BEGIN {marker}
HTTP.VERBOSE={verbose}
HTTP.COOKIEJAR={esgf_dir}/.dods_cookies
HTTP.SSL.VALIDATE=0
HTTP.SSL.CERTIFICATE={esgf_dir}/credentials.pem
HTTP.SSL.KEY={esgf_dir}/credentials.pem
HTTP.SSL.CAPATH={esgf_certs_dir}
# END {marker}
{postamble}
 format verbose N/A verbose 1 0 validate N/A validate 1 0 esgf_certs_dir N/A self esgf_certs_dir esgf_dir N/A self esgf_dir marker DAP_CONFIG_MARKER preamble preamble postamble postamble N/A _parse_dap_config N/A N/A self config_str N/A None N/A N/A 
        Read the DAP_CONFIG file and extract the parts not controlled 
        by esgf-pyclient.

        :return: (preamble, managed, postamble), three strings of 
            configuration lines before, within and after the esgf-pyclient 
            controlled block.

         N/A N/A config_str None N/A N/A N/A N/A N/A op exists N/A self dap_config N/A N/A N/A N/A config_str N/A N/A N/A open N/A self dap_config read N/A sections N/A N/A re split N/A N/A ^# (?:BEGIN|END) {0}$\n format DAP_CONFIG_MARKER config_str N/A re M N/A N/A N/A len sections 2 N/A N/A N/A preamble managed postamble N/A N/A sections N/A 0 N/A N/A N/A N/A len sections 2 N/A N/A N/A preamble managed postamble N/A sections N/A N/A N/A N/A N/A len sections 3 N/A N/A N/A preamble managed postamble sections N/A N/A N/A managed unmanaged N/A N/A N/A N/A N/A N/A sections reverse N/A sections N/A N/A N/A N/A unmanaged append N/A N/A sections pop N/A sections N/A N/A N/A N/A managed append N/A N/A sections pop N/A preamble N/A N/A join N/A unmanaged N/A -1 N/A postamble N/A unmanaged N/A -1 N/A managed N/A managed N/A -1 N/A N/A N/A N/A preamble strip N/A N/A managed strip N/A N/A postamble strip N/A N/A