+
+ Then :py:obj:`musicpd.MPDClient.connect` will use :py:obj:`host` and
+ :py:obj:`port` as defaults if not provided as args.
+
+ Regarding :envvar:`MPD_HOST` format to expose password refer this module
+ documentation or MPD client manual :manpage:`mpc (1)`.
+
+ >>> from os import environ
+ >>> environ['MPD_HOST'] = 'pass@mpdhost'
+ >>> cli = musicpd.MPDClient()
+ >>> cli.pwd == environ['MPD_HOST'].split('@')[0]
+ True
+ >>> cli.host == environ['MPD_HOST'].split('@')[1]
+ True
+ >>> cli.connect() # will use host/port as set in MPD_HOST/MPD_PORT
+
+ .. note::
+
+ default host:
+ * use :envvar:`MPD_HOST` environment variable if set, extract password if present,
+ * else use :envvar:`XDG_RUNTIME_DIR` to looks for an existing file in ``${XDG_RUNTIME_DIR:-/run/}/mpd/socket``
+ * else set host to ``localhost``
+
+ default port:
+ * use :envvar:`MPD_PORT` environment variable is set
+ * else use ``6600``
+
+ .. warning:: **Instance attribute host/port/pwd**
+
+ While :py:attr:`musicpd.MPDClient.host` and
+ :py:attr:`musicpd.MPDClient.port` keep track of current connection
+ host and port, :py:attr:`musicpd.MPDClient.pwd` is set once with
+ password extracted from environment variable.
+ Calling MPS's password method with a new password
+ won't update :py:attr:`musicpd.MPDClient.pwd` value.
+
+ Moreover, :py:attr:`musicpd.MPDClient.pwd` is only an helper attribute
+ exposing password extracted from :envvar:`MPD_HOST` environment variable, it
+ will not be used as default value for the MPD's password command.