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.
Files changed (223) hide show
  1. {soco-0.32.2/soco.egg-info → soco-0.32.3}/PKG-INFO +1 -1
  2. {soco-0.32.2 → soco-0.32.3}/soco/__init__.py +1 -1
  3. {soco-0.32.2 → soco-0.32.3}/soco/events_asyncio.py +2 -1
  4. {soco-0.32.2 → soco-0.32.3}/soco/events_base.py +35 -1
  5. {soco-0.32.2 → soco-0.32.3}/soco/music_services/accounts.py +6 -2
  6. {soco-0.32.2 → soco-0.32.3/soco.egg-info}/PKG-INFO +1 -1
  7. {soco-0.32.2 → soco-0.32.3}/tests/test_events.py +54 -2
  8. {soco-0.32.2 → soco-0.32.3}/tests/test_musicservices.py +18 -0
  9. {soco-0.32.2 → soco-0.32.3}/AUTHORS.rst +0 -0
  10. {soco-0.32.2 → soco-0.32.3}/LICENSE.rst +0 -0
  11. {soco-0.32.2 → soco-0.32.3}/MANIFEST.in +0 -0
  12. {soco-0.32.2 → soco-0.32.3}/README.rst +0 -0
  13. {soco-0.32.2 → soco-0.32.3}/dev_tools/analyse_ws.ini +0 -0
  14. {soco-0.32.2 → soco-0.32.3}/dev_tools/analyse_ws.py +0 -0
  15. {soco-0.32.2 → soco-0.32.3}/dev_tools/pychecker.bat +0 -0
  16. {soco-0.32.2 → soco-0.32.3}/dev_tools/pychecker.sh +0 -0
  17. {soco-0.32.2 → soco-0.32.3}/dev_tools/release.py +0 -0
  18. {soco-0.32.2 → soco-0.32.3}/dev_tools/sonosdump.py +0 -0
  19. {soco-0.32.2 → soco-0.32.3}/doc/Makefile +0 -0
  20. {soco-0.32.2 → soco-0.32.3}/doc/_static/imageMapResizer.min.js +0 -0
  21. {soco-0.32.2 → soco-0.32.3}/doc/_templates/page.html +0 -0
  22. {soco-0.32.2 → soco-0.32.3}/doc/advanced/data-structures-mod.rst +0 -0
  23. {soco-0.32.2 → soco-0.32.3}/doc/advanced/events.rst +0 -0
  24. {soco-0.32.2 → soco-0.32.3}/doc/advanced/events_asyncio.rst +0 -0
  25. {soco-0.32.2 → soco-0.32.3}/doc/advanced/events_twisted.rst +0 -0
  26. {soco-0.32.2 → soco-0.32.3}/doc/advanced/index.rst +0 -0
  27. {soco-0.32.2 → soco-0.32.3}/doc/advanced/services.rst +0 -0
  28. {soco-0.32.2 → soco-0.32.3}/doc/advanced/topology.rst +0 -0
  29. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.alarms.rst +0 -0
  30. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.cache.rst +0 -0
  31. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.config.rst +0 -0
  32. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.core.rst +0 -0
  33. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.data_structures.rst +0 -0
  34. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.discovery.rst +0 -0
  35. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.events.rst +0 -0
  36. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.exceptions.rst +0 -0
  37. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.favorites.rst +0 -0
  38. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.groups.rst +0 -0
  39. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.ms_data_structures.rst +0 -0
  40. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.music_library.rst +0 -0
  41. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.music_services.accounts.rst +0 -0
  42. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.music_services.music_service.rst +0 -0
  43. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.music_services.rst +0 -0
  44. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.music_services.token_store.rst +0 -0
  45. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.plugins.example.rst +0 -0
  46. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.plugins.plex.rst +0 -0
  47. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.plugins.rst +0 -0
  48. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.plugins.sharelink.rst +0 -0
  49. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.plugins.spotify.rst +0 -0
  50. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.plugins.wimp.rst +0 -0
  51. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.rst +0 -0
  52. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.services.rst +0 -0
  53. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.snapshot.rst +0 -0
  54. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.soap.rst +0 -0
  55. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.utils.rst +0 -0
  56. {soco-0.32.2 → soco-0.32.3}/doc/api/soco.xml.rst +0 -0
  57. {soco-0.32.2 → soco-0.32.3}/doc/authors.rst +0 -0
  58. {soco-0.32.2 → soco-0.32.3}/doc/conf.py +0 -0
  59. {soco-0.32.2 → soco-0.32.3}/doc/development/index.rst +0 -0
  60. {soco-0.32.2 → soco-0.32.3}/doc/development/release-howto.rst +0 -0
  61. {soco-0.32.2 → soco-0.32.3}/doc/development/unittests.rst +0 -0
  62. {soco-0.32.2 → soco-0.32.3}/doc/examples.rst +0 -0
  63. {soco-0.32.2 → soco-0.32.3}/doc/faq.rst +0 -0
  64. {soco-0.32.2 → soco-0.32.3}/doc/getting_started.rst +0 -0
  65. {soco-0.32.2 → soco-0.32.3}/doc/graphics/data_structures.png +0 -0
  66. {soco-0.32.2 → soco-0.32.3}/doc/graphics/data_structures.svg +0 -0
  67. {soco-0.32.2 → soco-0.32.3}/doc/index.rst +0 -0
  68. {soco-0.32.2 → soco-0.32.3}/doc/make.bat +0 -0
  69. {soco-0.32.2 → soco-0.32.3}/doc/plugins.rst +0 -0
  70. {soco-0.32.2 → soco-0.32.3}/doc/release_notes.rst +0 -0
  71. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.10.rst +0 -0
  72. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.11.1.rst +0 -0
  73. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.11.rst +0 -0
  74. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.12.rst +0 -0
  75. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.13.rst +0 -0
  76. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.14.rst +0 -0
  77. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.15.rst +0 -0
  78. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.16.rst +0 -0
  79. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.17.rst +0 -0
  80. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.18.rst +0 -0
  81. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.19.rst +0 -0
  82. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.20.rst +0 -0
  83. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.21.rst +0 -0
  84. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.22.rst +0 -0
  85. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.23.rst +0 -0
  86. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.24.rst +0 -0
  87. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.25.rst +0 -0
  88. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.26.rst +0 -0
  89. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.27.rst +0 -0
  90. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.28.rst +0 -0
  91. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.29.rst +0 -0
  92. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.30.rst +0 -0
  93. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.31.0.rst +0 -0
  94. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.32.0.rst +0 -0
  95. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.6.rst +0 -0
  96. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.7.rst +0 -0
  97. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.8.rst +0 -0
  98. {soco-0.32.2 → soco-0.32.3}/doc/releases/0.9.rst +0 -0
  99. {soco-0.32.2 → soco-0.32.3}/doc/releases/index.rst +0 -0
  100. {soco-0.32.2 → soco-0.32.3}/doc/requirements.txt +0 -0
  101. {soco-0.32.2 → soco-0.32.3}/doc/tutorial.rst +0 -0
  102. {soco-0.32.2 → soco-0.32.3}/examples/commandline/README.rst +0 -0
  103. {soco-0.32.2 → soco-0.32.3}/examples/commandline/discover.py +0 -0
  104. {soco-0.32.2 → soco-0.32.3}/examples/commandline/screenshot.png +0 -0
  105. {soco-0.32.2 → soco-0.32.3}/examples/commandline/tunein.py +0 -0
  106. {soco-0.32.2 → soco-0.32.3}/examples/events_asyncio_verify_listener_fix.py +0 -0
  107. {soco-0.32.2 → soco-0.32.3}/examples/play_local_files/play_local_files.py +0 -0
  108. {soco-0.32.2 → soco-0.32.3}/examples/plugins/socoplugins.py +0 -0
  109. {soco-0.32.2 → soco-0.32.3}/examples/snapshot/basic_snap.py +0 -0
  110. {soco-0.32.2 → soco-0.32.3}/examples/snapshot/multi_zone_snap.py +0 -0
  111. {soco-0.32.2 → soco-0.32.3}/examples/webapp/.gitignore +0 -0
  112. {soco-0.32.2 → soco-0.32.3}/examples/webapp/README.md +0 -0
  113. {soco-0.32.2 → soco-0.32.3}/examples/webapp/index.py +0 -0
  114. {soco-0.32.2 → soco-0.32.3}/examples/webapp/requirements.txt +0 -0
  115. {soco-0.32.2 → soco-0.32.3}/examples/webapp/screenshot.png +0 -0
  116. {soco-0.32.2 → soco-0.32.3}/examples/webapp/settings.py.example +0 -0
  117. {soco-0.32.2 → soco-0.32.3}/examples/webapp/static/css/bootstrap.min.css +0 -0
  118. {soco-0.32.2 → soco-0.32.3}/examples/webapp/static/css/main.css +0 -0
  119. {soco-0.32.2 → soco-0.32.3}/examples/webapp/static/img/blank.jpg +0 -0
  120. {soco-0.32.2 → soco-0.32.3}/examples/webapp/static/img/glyphicons-halflings-white.png +0 -0
  121. {soco-0.32.2 → soco-0.32.3}/examples/webapp/static/img/glyphicons-halflings.png +0 -0
  122. {soco-0.32.2 → soco-0.32.3}/examples/webapp/static/js/bootstrap.min.js +0 -0
  123. {soco-0.32.2 → soco-0.32.3}/examples/webapp/static/js/jquery.min.js +0 -0
  124. {soco-0.32.2 → soco-0.32.3}/examples/webapp/templates/index.html +0 -0
  125. {soco-0.32.2 → soco-0.32.3}/makefile +0 -0
  126. {soco-0.32.2 → soco-0.32.3}/pylintrc +0 -0
  127. {soco-0.32.2 → soco-0.32.3}/pyproject.toml +0 -0
  128. {soco-0.32.2 → soco-0.32.3}/requirements-dev.txt +0 -0
  129. {soco-0.32.2 → soco-0.32.3}/requirements.txt +0 -0
  130. {soco-0.32.2 → soco-0.32.3}/setup.cfg +0 -0
  131. {soco-0.32.2 → soco-0.32.3}/setup.py +0 -0
  132. {soco-0.32.2 → soco-0.32.3}/soco/alarms.py +0 -0
  133. {soco-0.32.2 → soco-0.32.3}/soco/cache.py +0 -0
  134. {soco-0.32.2 → soco-0.32.3}/soco/config.py +0 -0
  135. {soco-0.32.2 → soco-0.32.3}/soco/core.py +0 -0
  136. {soco-0.32.2 → soco-0.32.3}/soco/data_structure_quirks.py +0 -0
  137. {soco-0.32.2 → soco-0.32.3}/soco/data_structures.py +0 -0
  138. {soco-0.32.2 → soco-0.32.3}/soco/data_structures_entry.py +0 -0
  139. {soco-0.32.2 → soco-0.32.3}/soco/discovery.py +0 -0
  140. {soco-0.32.2 → soco-0.32.3}/soco/events.py +0 -0
  141. {soco-0.32.2 → soco-0.32.3}/soco/events_twisted.py +0 -0
  142. {soco-0.32.2 → soco-0.32.3}/soco/exceptions.py +0 -0
  143. {soco-0.32.2 → soco-0.32.3}/soco/favorites.py +0 -0
  144. {soco-0.32.2 → soco-0.32.3}/soco/groups.py +0 -0
  145. {soco-0.32.2 → soco-0.32.3}/soco/ms_data_structures.py +0 -0
  146. {soco-0.32.2 → soco-0.32.3}/soco/music_library.py +0 -0
  147. {soco-0.32.2 → soco-0.32.3}/soco/music_services/__init__.py +0 -0
  148. {soco-0.32.2 → soco-0.32.3}/soco/music_services/data_structures.py +0 -0
  149. {soco-0.32.2 → soco-0.32.3}/soco/music_services/music_service.py +0 -0
  150. {soco-0.32.2 → soco-0.32.3}/soco/music_services/token_store.py +0 -0
  151. {soco-0.32.2 → soco-0.32.3}/soco/plugins/__init__.py +0 -0
  152. {soco-0.32.2 → soco-0.32.3}/soco/plugins/example.py +0 -0
  153. {soco-0.32.2 → soco-0.32.3}/soco/plugins/plex.py +0 -0
  154. {soco-0.32.2 → soco-0.32.3}/soco/plugins/sharelink.py +0 -0
  155. {soco-0.32.2 → soco-0.32.3}/soco/plugins/spotify.py +0 -0
  156. {soco-0.32.2 → soco-0.32.3}/soco/plugins/wimp.py +0 -0
  157. {soco-0.32.2 → soco-0.32.3}/soco/services.py +0 -0
  158. {soco-0.32.2 → soco-0.32.3}/soco/snapshot.py +0 -0
  159. {soco-0.32.2 → soco-0.32.3}/soco/soap.py +0 -0
  160. {soco-0.32.2 → soco-0.32.3}/soco/utils.py +0 -0
  161. {soco-0.32.2 → soco-0.32.3}/soco/xml.py +0 -0
  162. {soco-0.32.2 → soco-0.32.3}/soco/zonegroupstate.py +0 -0
  163. {soco-0.32.2 → soco-0.32.3}/soco.egg-info/SOURCES.txt +0 -0
  164. {soco-0.32.2 → soco-0.32.3}/soco.egg-info/dependency_links.txt +0 -0
  165. {soco-0.32.2 → soco-0.32.3}/soco.egg-info/requires.txt +0 -0
  166. {soco-0.32.2 → soco-0.32.3}/soco.egg-info/top_level.txt +0 -0
  167. {soco-0.32.2 → soco-0.32.3}/tests/conftest.py +0 -0
  168. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/album.json +0 -0
  169. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/album.xml +0 -0
  170. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/album_compilation.xml +0 -0
  171. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/album_favorite.xml +0 -0
  172. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/album_list.xml +0 -0
  173. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/artist.json +0 -0
  174. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/artist.xml +0 -0
  175. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/audio_broadcast.json +0 -0
  176. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/audio_broadcast.xml +0 -0
  177. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/composer.json +0 -0
  178. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/composer.xml +0 -0
  179. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/genre.json +0 -0
  180. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/genre.xml +0 -0
  181. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/playlist.json +0 -0
  182. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/playlist.xml +0 -0
  183. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/playlist_favorite.xml +0 -0
  184. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/radio_show.json +0 -0
  185. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/radio_show.xml +0 -0
  186. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/recent_show.xml +0 -0
  187. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/same_artist.xml +0 -0
  188. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/share.json +0 -0
  189. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/share.xml +0 -0
  190. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/source_linein.xml +0 -0
  191. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/track.json +0 -0
  192. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/track.xml +0 -0
  193. {soco-0.32.2 → soco-0.32.3}/tests/data/data_structures_entry_integration/tracklist.xml +0 -0
  194. {soco-0.32.2 → soco-0.32.3}/tests/data/media_metadata_payloads/bbc.json +0 -0
  195. {soco-0.32.2 → soco-0.32.3}/tests/data/media_metadata_payloads/cifs.json +0 -0
  196. {soco-0.32.2 → soco-0.32.3}/tests/data/media_metadata_payloads/pandora.json +0 -0
  197. {soco-0.32.2 → soco-0.32.3}/tests/data/media_metadata_payloads/sonos_radio.json +0 -0
  198. {soco-0.32.2 → soco-0.32.3}/tests/data/media_metadata_payloads/tunein.json +0 -0
  199. {soco-0.32.2 → soco-0.32.3}/tests/data/media_metadata_payloads/tunein_2.json +0 -0
  200. {soco-0.32.2 → soco-0.32.3}/tests/official_and_extended_didl_classes.txt +0 -0
  201. {soco-0.32.2 → soco-0.32.3}/tests/soco_unittest.py +0 -0
  202. {soco-0.32.2 → soco-0.32.3}/tests/test_alarms.py +0 -0
  203. {soco-0.32.2 → soco-0.32.3}/tests/test_cache.py +0 -0
  204. {soco-0.32.2 → soco-0.32.3}/tests/test_core.py +0 -0
  205. {soco-0.32.2 → soco-0.32.3}/tests/test_data_structures_entry_integration.py +0 -0
  206. {soco-0.32.2 → soco-0.32.3}/tests/test_discovery.py +0 -0
  207. {soco-0.32.2 → soco-0.32.3}/tests/test_events_asyncio.py +0 -0
  208. {soco-0.32.2 → soco-0.32.3}/tests/test_favorites.py +0 -0
  209. {soco-0.32.2 → soco-0.32.3}/tests/test_integration.py +0 -0
  210. {soco-0.32.2 → soco-0.32.3}/tests/test_metadata_parsing.py +0 -0
  211. {soco-0.32.2 → soco-0.32.3}/tests/test_ms_data_structures.py +0 -0
  212. {soco-0.32.2 → soco-0.32.3}/tests/test_music_library.py +0 -0
  213. {soco-0.32.2 → soco-0.32.3}/tests/test_music_service_data_structures.py +0 -0
  214. {soco-0.32.2 → soco-0.32.3}/tests/test_new_datastructures.py +0 -0
  215. {soco-0.32.2 → soco-0.32.3}/tests/test_release_script.py +0 -0
  216. {soco-0.32.2 → soco-0.32.3}/tests/test_services.py +0 -0
  217. {soco-0.32.2 → soco-0.32.3}/tests/test_sharelink.py +0 -0
  218. {soco-0.32.2 → soco-0.32.3}/tests/test_singleton.py +0 -0
  219. {soco-0.32.2 → soco-0.32.3}/tests/test_snapshot.py +0 -0
  220. {soco-0.32.2 → soco-0.32.3}/tests/test_soap.py +0 -0
  221. {soco-0.32.2 → soco-0.32.3}/tests/test_utils.py +0 -0
  222. {soco-0.32.2 → soco-0.32.3}/tests/test_xml.py +0 -0
  223. {soco-0.32.2 → soco-0.32.3}/tests/test_zonegroupstate.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: soco
3
- Version: 0.32.2
3
+ Version: 0.32.3
4
4
  Summary: SoCo (Sonos Controller) is a simple library to control Sonos speakers.
5
5
  Author-email: The SoCo-Team <python-soco@googlegroups.com>
6
6
  License-Expression: MIT
@@ -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.2"
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, and, so far, we cannot decrypt it
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.debug("Account data: %s", result)
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: soco
3
- Version: 0.32.2
3
+ Version: 0.32.3
4
4
  Summary: SoCo (Sonos Controller) is a simple library to control Sonos speakers.
5
5
  Author-email: The SoCo-Team <python-soco@googlegroups.com>
6
6
  License-Expression: MIT
@@ -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 Event, get_listen_ip, parse_event_xml
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 AttributeError: 'NoneType' has no attribute 'startswith'
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