soco 0.32.2__tar.gz → 0.32.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {soco-0.32.2/soco.egg-info → soco-0.32.3}/PKG-INFO +1 -1
- {soco-0.32.2 → soco-0.32.3}/soco/__init__.py +1 -1
- {soco-0.32.2 → soco-0.32.3}/soco/events_asyncio.py +2 -1
- {soco-0.32.2 → soco-0.32.3}/soco/events_base.py +35 -1
- {soco-0.32.2 → soco-0.32.3}/soco/music_services/accounts.py +6 -2
- {soco-0.32.2 → soco-0.32.3/soco.egg-info}/PKG-INFO +1 -1
- {soco-0.32.2 → soco-0.32.3}/tests/test_events.py +54 -2
- {soco-0.32.2 → soco-0.32.3}/tests/test_musicservices.py +18 -0
- {soco-0.32.2 → soco-0.32.3}/AUTHORS.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/LICENSE.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/MANIFEST.in +0 -0
- {soco-0.32.2 → soco-0.32.3}/README.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/dev_tools/analyse_ws.ini +0 -0
- {soco-0.32.2 → soco-0.32.3}/dev_tools/analyse_ws.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/dev_tools/pychecker.bat +0 -0
- {soco-0.32.2 → soco-0.32.3}/dev_tools/pychecker.sh +0 -0
- {soco-0.32.2 → soco-0.32.3}/dev_tools/release.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/dev_tools/sonosdump.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/Makefile +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/_static/imageMapResizer.min.js +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/_templates/page.html +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/advanced/data-structures-mod.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/advanced/events.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/advanced/events_asyncio.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/advanced/events_twisted.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/advanced/index.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/advanced/services.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/advanced/topology.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.alarms.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.cache.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.config.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.core.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.data_structures.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.discovery.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.events.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.exceptions.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.favorites.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.groups.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.ms_data_structures.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.music_library.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.music_services.accounts.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.music_services.music_service.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.music_services.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.music_services.token_store.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.plugins.example.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.plugins.plex.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.plugins.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.plugins.sharelink.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.plugins.spotify.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.plugins.wimp.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.services.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.snapshot.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.soap.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.utils.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/api/soco.xml.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/authors.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/conf.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/development/index.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/development/release-howto.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/development/unittests.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/examples.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/faq.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/getting_started.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/graphics/data_structures.png +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/graphics/data_structures.svg +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/index.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/make.bat +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/plugins.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/release_notes.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.10.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.11.1.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.11.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.12.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.13.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.14.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.15.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.16.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.17.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.18.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.19.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.20.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.21.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.22.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.23.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.24.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.25.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.26.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.27.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.28.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.29.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.30.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.31.0.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.32.0.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.6.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.7.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.8.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/0.9.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/releases/index.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/requirements.txt +0 -0
- {soco-0.32.2 → soco-0.32.3}/doc/tutorial.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/commandline/README.rst +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/commandline/discover.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/commandline/screenshot.png +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/commandline/tunein.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/events_asyncio_verify_listener_fix.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/play_local_files/play_local_files.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/plugins/socoplugins.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/snapshot/basic_snap.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/snapshot/multi_zone_snap.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/webapp/.gitignore +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/webapp/README.md +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/webapp/index.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/webapp/requirements.txt +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/webapp/screenshot.png +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/webapp/settings.py.example +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/webapp/static/css/bootstrap.min.css +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/webapp/static/css/main.css +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/webapp/static/img/blank.jpg +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/webapp/static/img/glyphicons-halflings-white.png +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/webapp/static/img/glyphicons-halflings.png +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/webapp/static/js/bootstrap.min.js +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/webapp/static/js/jquery.min.js +0 -0
- {soco-0.32.2 → soco-0.32.3}/examples/webapp/templates/index.html +0 -0
- {soco-0.32.2 → soco-0.32.3}/makefile +0 -0
- {soco-0.32.2 → soco-0.32.3}/pylintrc +0 -0
- {soco-0.32.2 → soco-0.32.3}/pyproject.toml +0 -0
- {soco-0.32.2 → soco-0.32.3}/requirements-dev.txt +0 -0
- {soco-0.32.2 → soco-0.32.3}/requirements.txt +0 -0
- {soco-0.32.2 → soco-0.32.3}/setup.cfg +0 -0
- {soco-0.32.2 → soco-0.32.3}/setup.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/alarms.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/cache.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/config.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/core.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/data_structure_quirks.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/data_structures.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/data_structures_entry.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/discovery.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/events.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/events_twisted.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/exceptions.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/favorites.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/groups.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/ms_data_structures.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/music_library.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/music_services/__init__.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/music_services/data_structures.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/music_services/music_service.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/music_services/token_store.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/plugins/__init__.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/plugins/example.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/plugins/plex.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/plugins/sharelink.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/plugins/spotify.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/plugins/wimp.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/services.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/snapshot.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/soap.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/utils.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/xml.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco/zonegroupstate.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco.egg-info/SOURCES.txt +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco.egg-info/dependency_links.txt +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco.egg-info/requires.txt +0 -0
- {soco-0.32.2 → soco-0.32.3}/soco.egg-info/top_level.txt +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/conftest.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/album.json +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/album.xml +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/album_compilation.xml +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/album_favorite.xml +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/album_list.xml +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/artist.json +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/artist.xml +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/audio_broadcast.json +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/audio_broadcast.xml +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/composer.json +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/composer.xml +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/genre.json +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/genre.xml +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/playlist.json +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/playlist.xml +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/playlist_favorite.xml +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/radio_show.json +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/radio_show.xml +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/recent_show.xml +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/same_artist.xml +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/share.json +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/share.xml +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/source_linein.xml +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/track.json +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/track.xml +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/tracklist.xml +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/media_metadata_payloads/bbc.json +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/media_metadata_payloads/cifs.json +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/media_metadata_payloads/pandora.json +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/media_metadata_payloads/sonos_radio.json +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/media_metadata_payloads/tunein.json +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/data/media_metadata_payloads/tunein_2.json +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/official_and_extended_didl_classes.txt +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/soco_unittest.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_alarms.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_cache.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_core.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_data_structures_entry_integration.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_discovery.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_events_asyncio.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_favorites.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_integration.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_metadata_parsing.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_ms_data_structures.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_music_library.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_music_service_data_structures.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_new_datastructures.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_release_script.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_services.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_sharelink.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_singleton.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_snapshot.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_soap.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_utils.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_xml.py +0 -0
- {soco-0.32.2 → soco-0.32.3}/tests/test_zonegroupstate.py +0 -0
|
@@ -17,7 +17,7 @@ from .exceptions import SoCoException, UnknownSoCoException
|
|
|
17
17
|
__author__ = "The SoCo-Team <python-soco@googlegroups.com>"
|
|
18
18
|
# Please increment the version number and add the suffix "-dev" after
|
|
19
19
|
# a release, to make it possible to identify in-development code
|
|
20
|
-
__version__ = "0.32.
|
|
20
|
+
__version__ = "0.32.3"
|
|
21
21
|
__website__ = "https://github.com/SoCo/SoCo"
|
|
22
22
|
__license__ = "MIT License"
|
|
23
23
|
|
|
@@ -85,6 +85,7 @@ from .events_base import Event # noqa: F401
|
|
|
85
85
|
from .events_base import ( # noqa: E402
|
|
86
86
|
get_listen_ip,
|
|
87
87
|
parse_event_xml,
|
|
88
|
+
redact_event_content,
|
|
88
89
|
EventNotifyHandlerBase,
|
|
89
90
|
EventListenerBase,
|
|
90
91
|
SubscriptionBase,
|
|
@@ -123,7 +124,7 @@ class EventNotifyHandler(EventNotifyHandlerBase):
|
|
|
123
124
|
timestamp = time.time()
|
|
124
125
|
service = subscription.service
|
|
125
126
|
self.log_event(seq, service.service_id, timestamp)
|
|
126
|
-
log.debug("Event content: %s", content)
|
|
127
|
+
log.debug("Event content: %s", redact_event_content(content))
|
|
127
128
|
if "x-sonos-http" in content:
|
|
128
129
|
# parse_event_xml will generate I/O if
|
|
129
130
|
# x-sonos-http is in the content
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import atexit
|
|
11
11
|
from functools import lru_cache
|
|
12
12
|
import logging
|
|
13
|
+
import re
|
|
13
14
|
import socket
|
|
14
15
|
import time
|
|
15
16
|
import threading
|
|
@@ -24,6 +25,37 @@ from .xml import XML
|
|
|
24
25
|
|
|
25
26
|
log = logging.getLogger(__name__) # pylint: disable=C0103
|
|
26
27
|
|
|
28
|
+
# Evented variables whose values contain credentials. The
|
|
29
|
+
# ThirdPartyMediaServersX blob holds the household's music service accounts,
|
|
30
|
+
# including access and refresh tokens. It is encrypted, but it has been
|
|
31
|
+
# reported that it can be decrypted using information available on the LAN.
|
|
32
|
+
# See https://github.com/SoCo/SoCo/issues/1009
|
|
33
|
+
REDACTED_VARIABLES = ("ThirdPartyMediaServersX",)
|
|
34
|
+
REDACTED_VALUE = "[redacted]"
|
|
35
|
+
|
|
36
|
+
_REDACT_PATTERN = "(<({tags})>).*?(</\\2>)".format(tags="|".join(REDACTED_VARIABLES))
|
|
37
|
+
_REDACT_RE_STR = re.compile(_REDACT_PATTERN, re.DOTALL)
|
|
38
|
+
_REDACT_RE_BYTES = re.compile(_REDACT_PATTERN.encode("ascii"), re.DOTALL)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def redact_event_content(content):
|
|
42
|
+
"""Redact the values of credential-bearing variables in a raw event body.
|
|
43
|
+
|
|
44
|
+
Used so that the raw event body can be logged safely.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
content (str or bytes): the raw body of a UPnP event.
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
str or bytes: the content, of the same type as was passed in, with
|
|
51
|
+
the values of `REDACTED_VARIABLES` replaced by ``[redacted]``.
|
|
52
|
+
"""
|
|
53
|
+
if isinstance(content, bytes):
|
|
54
|
+
return _REDACT_RE_BYTES.sub(
|
|
55
|
+
b"\\1" + REDACTED_VALUE.encode("ascii") + b"\\3", content
|
|
56
|
+
)
|
|
57
|
+
return _REDACT_RE_STR.sub("\\1" + REDACTED_VALUE + "\\3", content)
|
|
58
|
+
|
|
27
59
|
|
|
28
60
|
@lru_cache()
|
|
29
61
|
def parse_event_xml(xml_event):
|
|
@@ -121,6 +153,8 @@ def parse_event_xml(xml_event):
|
|
|
121
153
|
result[tag][channel] = value
|
|
122
154
|
else:
|
|
123
155
|
result[tag] = value
|
|
156
|
+
elif variable.tag in REDACTED_VARIABLES:
|
|
157
|
+
result[camel_to_underscore(variable.tag)] = REDACTED_VALUE
|
|
124
158
|
else:
|
|
125
159
|
result[camel_to_underscore(variable.tag)] = variable.text
|
|
126
160
|
return result
|
|
@@ -229,7 +263,7 @@ class EventNotifyHandlerBase:
|
|
|
229
263
|
if subscription:
|
|
230
264
|
service = subscription.service
|
|
231
265
|
self.log_event(seq, service.service_id, timestamp)
|
|
232
|
-
log.debug("Event content: %s", content)
|
|
266
|
+
log.debug("Event content: %s", redact_event_content(content))
|
|
233
267
|
variables = parse_event_xml(content)
|
|
234
268
|
# Build the Event object
|
|
235
269
|
event = Event(sid, seq, service, timestamp, variables)
|
|
@@ -69,12 +69,16 @@ class Account:
|
|
|
69
69
|
# It is likely that the same information is available over UPnP as well
|
|
70
70
|
# via a call to
|
|
71
71
|
# systemProperties.GetStringX([('VariableName','R_SvcAccounts')]))
|
|
72
|
-
# This returns an encrypted string
|
|
72
|
+
# This returns an encrypted string. It has been reported that the
|
|
73
|
+
# related ThirdPartyMediaServersX value (which contains music service
|
|
74
|
+
# account tokens) can be decrypted; see
|
|
75
|
+
# https://github.com/SoCo/SoCo/issues/1009
|
|
73
76
|
device = soco or discovery.any_soco()
|
|
74
77
|
log.debug("Fetching account data from %s", device)
|
|
75
78
|
settings_url = device.base_url + "/status/accounts"
|
|
76
79
|
result = requests.get(settings_url, timeout=config.REQUEST_TIMEOUT).content
|
|
77
|
-
log
|
|
80
|
+
# Don't log the content: it may contain account credentials
|
|
81
|
+
log.debug("Account data: %d bytes", len(result))
|
|
78
82
|
return result
|
|
79
83
|
|
|
80
84
|
@classmethod
|
|
@@ -8,7 +8,12 @@ import pytest
|
|
|
8
8
|
from soco import config
|
|
9
9
|
from soco.data_structures import DidlAudioLineIn
|
|
10
10
|
from soco.events import EventNotifyHandler
|
|
11
|
-
from soco.events_base import
|
|
11
|
+
from soco.events_base import (
|
|
12
|
+
Event,
|
|
13
|
+
get_listen_ip,
|
|
14
|
+
parse_event_xml,
|
|
15
|
+
redact_event_content,
|
|
16
|
+
)
|
|
12
17
|
from soco.services import ZoneGroupTopology
|
|
13
18
|
|
|
14
19
|
from conftest import DataLoader
|
|
@@ -101,6 +106,29 @@ def test_event_parsing():
|
|
|
101
106
|
assert event_dict["zone_group_id"] == "RINCON_000XXXX01400:57"
|
|
102
107
|
|
|
103
108
|
|
|
109
|
+
def test_event_parsing_redacts_third_party_media_servers():
|
|
110
|
+
"""The ThirdPartyMediaServersX blob holds music service credentials, so its
|
|
111
|
+
value must not be passed on to event subscribers."""
|
|
112
|
+
event_dict = parse_event_xml(DUMMY_EVENT)
|
|
113
|
+
assert event_dict["third_party_media_servers_x"] == "[redacted]"
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
@pytest.mark.parametrize("content", [DUMMY_EVENT, DUMMY_EVENT.encode("utf-8")])
|
|
117
|
+
def test_redact_event_content(content):
|
|
118
|
+
redacted = redact_event_content(content)
|
|
119
|
+
assert type(redacted) is type(content)
|
|
120
|
+
as_text = redacted if isinstance(redacted, str) else redacted.decode("utf-8")
|
|
121
|
+
assert "s+3N9Lby8yoJD/QOC4W" not in as_text
|
|
122
|
+
assert "<ThirdPartyMediaServersX>[redacted]</ThirdPartyMediaServersX>" in as_text
|
|
123
|
+
# The rest of the event is untouched
|
|
124
|
+
assert "RINCON_000EXXXXXX0:56:0" in as_text
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def test_redact_event_content_without_blob():
|
|
128
|
+
content = b"<e:propertyset><e:property><Foo>bar</Foo></e:property></e:propertyset>"
|
|
129
|
+
assert redact_event_content(content) == content
|
|
130
|
+
|
|
131
|
+
|
|
104
132
|
def test_event_parsing_linein():
|
|
105
133
|
xml_message = DATA_LOADER.load_xml("source_linein.xml")
|
|
106
134
|
result = parse_event_xml(xml_message)
|
|
@@ -127,7 +155,8 @@ def test_event_parsing_null_value():
|
|
|
127
155
|
"</e:property>"
|
|
128
156
|
"</e:propertyset>"
|
|
129
157
|
)
|
|
130
|
-
# Before the fix this raised
|
|
158
|
+
# Before the fix this raised
|
|
159
|
+
# AttributeError: 'NoneType' has no attribute 'startswith'
|
|
131
160
|
result = parse_event_xml(event_xml)
|
|
132
161
|
assert result["current_track_uri"] is None
|
|
133
162
|
|
|
@@ -240,3 +269,26 @@ def test_get_listen_ip_connect_failure():
|
|
|
240
269
|
with mock.patch("soco.events_base.socket.socket", return_value=sock):
|
|
241
270
|
result = get_listen_ip("192.168.1.42")
|
|
242
271
|
assert result is None
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
def test_handle_notification_redacts_logged_content(caplog):
|
|
275
|
+
"""The debug log of the raw event must not include the
|
|
276
|
+
ThirdPartyMediaServersX blob."""
|
|
277
|
+
service, _ = _zgt_service()
|
|
278
|
+
subscription = mock.Mock()
|
|
279
|
+
subscription.service = service
|
|
280
|
+
subscriptions_map = mock.Mock()
|
|
281
|
+
subscriptions_map.get_subscription.return_value = subscription
|
|
282
|
+
|
|
283
|
+
handler = EventNotifyHandler.__new__(EventNotifyHandler)
|
|
284
|
+
handler.subscriptions_map = subscriptions_map
|
|
285
|
+
handler.log_event = mock.Mock()
|
|
286
|
+
|
|
287
|
+
with caplog.at_level(logging.DEBUG, logger="soco.events_base"):
|
|
288
|
+
handler.handle_notification(
|
|
289
|
+
{"seq": "0", "sid": "uuid:test_sid"}, DUMMY_EVENT.encode("utf-8")
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
assert "Event content:" in caplog.text
|
|
293
|
+
assert "s+3N9Lby8yoJD/QOC4W" not in caplog.text
|
|
294
|
+
assert "[redacted]" in caplog.text
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""Tests for the music_service module."""
|
|
2
2
|
|
|
3
|
+
import logging
|
|
3
4
|
from unittest import mock
|
|
4
5
|
import pytest
|
|
5
6
|
|
|
@@ -11,6 +12,9 @@ from soco.music_services.music_service import MusicService
|
|
|
11
12
|
# Typical account data from http://{Sonos-ip}:1400/status/accounts
|
|
12
13
|
from soco.music_services.token_store import JsonFileTokenStore
|
|
13
14
|
|
|
15
|
+
# Keep a reference to the real method, which the autouse fixture patches out
|
|
16
|
+
_REAL_GET_ACCOUNT_XML = Account._get_account_xml
|
|
17
|
+
|
|
14
18
|
ACCOUNT_DATA = """<?xml version="1.0" ?>
|
|
15
19
|
<ZPSupportInfo type="User">
|
|
16
20
|
<Accounts
|
|
@@ -322,3 +326,17 @@ def test_desc():
|
|
|
322
326
|
# assert desc_from_uri(NO_DATA) == "RINCON_AssociatedZPUDN"
|
|
323
327
|
# HTTP = "http://archive.org/download/TenD/TenD2005-07-16t10Wonderboy_64kb.mp3"
|
|
324
328
|
# assert desc_from_uri(HTTP) == "RINCON_AssociatedZPUDN"
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
def test_get_account_xml_does_not_log_content(caplog):
|
|
332
|
+
"""The account data may contain credentials, so it must not be logged."""
|
|
333
|
+
device = mock.Mock()
|
|
334
|
+
device.base_url = "http://192.168.1.100:1400"
|
|
335
|
+
response = mock.Mock()
|
|
336
|
+
response.content = b"<Accounts><Key>secret-key-value</Key></Accounts>"
|
|
337
|
+
with mock.patch(
|
|
338
|
+
"soco.music_services.accounts.requests.get", return_value=response
|
|
339
|
+
), caplog.at_level(logging.DEBUG, logger="soco.music_services.accounts"):
|
|
340
|
+
assert _REAL_GET_ACCOUNT_XML(device) == response.content
|
|
341
|
+
assert "Account data:" in caplog.text
|
|
342
|
+
assert "secret-key-value" not in caplog.text
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/album_compilation.xml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/audio_broadcast.json
RENAMED
|
File without changes
|
{soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/audio_broadcast.xml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/playlist_favorite.xml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|