File: connect_host.py

package info (click to toggle)
python-musicpd 0.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 484 kB
  • sloc: python: 792; makefile: 6
file content (17 lines) | stat: -rw-r--r-- 378 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import sys
import logging

import musicpd

# Set logging to debug level
logging.basicConfig(level=logging.DEBUG, format='%(levelname)-8s %(message)s')

client = musicpd.MPDClient()
try:
    client.connect(host='example.lan')
    client.password('secret')
    client.status()
except musicpd.MPDError as err:
    print(f'An error occured: {err}')
finally:
    client.disconnect()