python-openhab-rest-client 0.2.0__tar.gz → 0.2.2__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 (108) hide show
  1. {python_openhab_rest_client-0.2.0/python_openhab_rest_client.egg-info → python_openhab_rest_client-0.2.2}/PKG-INFO +1 -1
  2. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Actions.py +2 -2
  3. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Addons.py +10 -13
  4. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Audio.py +4 -4
  5. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Auth.py +4 -6
  6. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/ChannelTypes.py +3 -4
  7. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Client.py +9 -6
  8. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/ConfigDescriptions.py +2 -2
  9. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Discovery.py +4 -4
  10. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Iconsets.py +5 -2
  11. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Inbox.py +1 -1
  12. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Logging.py +1 -2
  13. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Sitemaps.py +2 -0
  14. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ItemEvents.py +1 -0
  15. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Links.py +2 -2
  16. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2/python_openhab_rest_client.egg-info}/PKG-INFO +1 -1
  17. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/setup.py +1 -1
  18. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Discovery.py +1 -0
  19. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Links.py +1 -0
  20. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/LICENSE +0 -0
  21. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/README.md +0 -0
  22. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Events.py +0 -0
  23. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Items.py +0 -0
  24. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Links.py +0 -0
  25. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/ModuleTypes.py +0 -0
  26. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Persistence.py +0 -0
  27. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/ProfileTypes.py +0 -0
  28. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Rules.py +0 -0
  29. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Services.py +0 -0
  30. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Systeminfo.py +0 -0
  31. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Tags.py +0 -0
  32. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Templates.py +0 -0
  33. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/ThingTypes.py +0 -0
  34. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Things.py +0 -0
  35. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Transformations.py +0 -0
  36. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/UI.py +0 -0
  37. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/UUID.py +0 -0
  38. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Voice.py +0 -0
  39. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/__init__.py +0 -0
  40. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Actions.py +0 -0
  41. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Addons.py +0 -0
  42. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Audio.py +0 -0
  43. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Auth.py +0 -0
  44. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ChannelEvents.py +0 -0
  45. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ChannelTypes.py +0 -0
  46. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ConfigDescriptions.py +0 -0
  47. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Discovery.py +0 -0
  48. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Events.py +0 -0
  49. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Iconsets.py +0 -0
  50. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Inbox.py +0 -0
  51. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/InboxEvents.py +0 -0
  52. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Items.py +0 -0
  53. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/LinkEvents.py +0 -0
  54. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Logging.py +0 -0
  55. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ModuleTypes.py +0 -0
  56. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Persistence.py +0 -0
  57. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ProfileTypes.py +0 -0
  58. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Rules.py +0 -0
  59. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Services.py +0 -0
  60. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Sitemaps.py +0 -0
  61. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Systeminfo.py +0 -0
  62. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Tags.py +0 -0
  63. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Templates.py +0 -0
  64. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ThingEvents.py +0 -0
  65. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ThingTypes.py +0 -0
  66. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Things.py +0 -0
  67. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Transformations.py +0 -0
  68. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/UI.py +0 -0
  69. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/UUID.py +0 -0
  70. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Voice.py +0 -0
  71. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/__init__.py +0 -0
  72. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/python_openhab_rest_client.egg-info/SOURCES.txt +0 -0
  73. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/python_openhab_rest_client.egg-info/dependency_links.txt +0 -0
  74. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/python_openhab_rest_client.egg-info/requires.txt +0 -0
  75. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/python_openhab_rest_client.egg-info/top_level.txt +0 -0
  76. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/setup.cfg +0 -0
  77. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Actions.py +0 -0
  78. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Addons.py +0 -0
  79. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Audio.py +0 -0
  80. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Auth.py +0 -0
  81. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ChannelEvents.py +0 -0
  82. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ChannelTypes.py +0 -0
  83. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ConfigDescriptions.py +0 -0
  84. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Events.py +0 -0
  85. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Iconsets.py +0 -0
  86. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Inbox.py +0 -0
  87. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/InboxEvents.py +0 -0
  88. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ItemEvents.py +0 -0
  89. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Items.py +0 -0
  90. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/LinkEvents.py +0 -0
  91. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Logging.py +0 -0
  92. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ModuleTypes.py +0 -0
  93. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Persistence.py +0 -0
  94. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ProfileTypes.py +0 -0
  95. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Rules.py +0 -0
  96. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Services.py +0 -0
  97. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Sitemaps.py +0 -0
  98. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Systeminfo.py +0 -0
  99. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Tags.py +0 -0
  100. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Templates.py +0 -0
  101. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ThingEvents.py +0 -0
  102. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ThingTypes.py +0 -0
  103. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Things.py +0 -0
  104. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Transformations.py +0 -0
  105. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/UI.py +0 -0
  106. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/UUID.py +0 -0
  107. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Voice.py +0 -0
  108. {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-openhab-rest-client
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: A Python client for the openHAB REST API. This library enables easy interaction with the openHAB REST API to control smart home devices, retrieve status information, and process events.
5
5
  Home-page: https://github.com/Michdo93/python-openhab-rest-client
6
6
  Author: Michael Christian Dörflinger
@@ -21,7 +21,7 @@ class Actions:
21
21
 
22
22
  :return: A list of actions.
23
23
  """
24
- header = {"Content-Type": "application/json"}
24
+ header = {"Accept": "application/json"}
25
25
  if language:
26
26
  header["Accept-Language"] = language
27
27
 
@@ -65,7 +65,7 @@ class Actions:
65
65
 
66
66
  :return: A response from the server.
67
67
  """
68
- header = {"Content-Type": "application/json"}
68
+ header = {"Content-Type": "application/json", "Accept": "application/json"}
69
69
  if language:
70
70
  header["Accept-Language"] = language
71
71
 
@@ -23,7 +23,7 @@ class Addons:
23
23
  :return: A dictionary containing the add-ons data.
24
24
  """
25
25
  params = {"serviceId": serviceID} if serviceID else {}
26
- header = {"Content-Type": "application/json"}
26
+ header = {"Accept": "application/json"}
27
27
  if language:
28
28
  header["Accept-Language"] = language
29
29
 
@@ -63,7 +63,7 @@ class Addons:
63
63
  :return: A dictionary containing details of the specified add-on.
64
64
  """
65
65
  params = {"serviceId": serviceID} if serviceID else {}
66
- header = {"Content-Type": "application/json"}
66
+ header = {"Accept": "application/json"}
67
67
  if language:
68
68
  header["Accept-Language"] = language
69
69
 
@@ -106,7 +106,7 @@ class Addons:
106
106
 
107
107
  try:
108
108
  response = self.client.get(
109
- f"/addons/{addonID}/config", header={"Content-Type": "application/json"}, params=params)
109
+ f"/addons/{addonID}/config", header={"Accept": "application/json"}, params=params)
110
110
 
111
111
  if isinstance(response, dict) and "status" in response:
112
112
  status_code = response["status"]
@@ -151,7 +151,7 @@ class Addons:
151
151
 
152
152
  try:
153
153
  response = self.client.put(
154
- f"/addons/{addonID}/config", header={"Content-Type": "application/json"}, data=json.dumps(data))
154
+ f"/addons/{addonID}/config", header={"Content-Type": "application/json", "Accept": "application/json"}, data=json.dumps(data))
155
155
 
156
156
  if isinstance(response, dict) and "status" in response:
157
157
  status_code = response["status"]
@@ -189,11 +189,10 @@ class Addons:
189
189
  :return: A dictionary containing the installation status.
190
190
  """
191
191
  data = {"serviceId": serviceID} if serviceID else {}
192
- header = {"Content-Type": "application/json"}
193
192
 
194
193
  try:
195
194
  response = self.client.post(
196
- f"/addons/{addonID}/install", header=header, data=data)
195
+ f"/addons/{addonID}/install", data=data)
197
196
 
198
197
  if isinstance(response, dict) and "status" in response:
199
198
  status_code = response["status"]
@@ -227,11 +226,10 @@ class Addons:
227
226
  :return: A dictionary containing the uninstallation status.
228
227
  """
229
228
  data = {"serviceId": serviceID} if serviceID else {}
230
- header = {"Content-Type": "application/json"}
231
229
 
232
230
  try:
233
231
  response = self.client.post(
234
- f"/addons/{addonID}/uninstall", header=header, data=data)
232
+ f"/addons/{addonID}/uninstall", data=data)
235
233
 
236
234
  if isinstance(response, dict) and "status" in response:
237
235
  status_code = response["status"]
@@ -263,7 +261,7 @@ class Addons:
263
261
 
264
262
  :return: A dictionary containing the available add-on services.
265
263
  """
266
- header = {"Content-Type": "application/json"}
264
+ header = {"Accept": "application/json"}
267
265
  if language:
268
266
  header["Accept-Language"] = language
269
267
 
@@ -297,7 +295,7 @@ class Addons:
297
295
 
298
296
  :return: A dictionary containing suggested add-ons.
299
297
  """
300
- header = {"Content-Type": "application/json"}
298
+ header = {"Accept": "application/json"}
301
299
  if language:
302
300
  header["Accept-Language"] = language
303
301
 
@@ -332,7 +330,7 @@ class Addons:
332
330
  :return: A dictionary containing available add-on types.
333
331
  """
334
332
  params = {"serviceId": serviceID} if serviceID else {}
335
- header = {"Content-Type": "application/json"}
333
+ header = {"Accept": "application/json"}
336
334
  if language:
337
335
  header["Accept-Language"] = language
338
336
 
@@ -374,8 +372,7 @@ class Addons:
374
372
  endpoint = f"/addons/url/{encoded_url}/install"
375
373
 
376
374
  try:
377
- response = self.client.post(
378
- endpoint, header={"Content-Type": "text/plain"}, data=None)
375
+ response = self.client.post(endpoint, data=None)
379
376
 
380
377
  if isinstance(response, dict) and "status" in response:
381
378
  status_code = response["status"]
@@ -19,7 +19,7 @@ class Audio:
19
19
 
20
20
  :return: A dictionary containing information about the default sink.
21
21
  """
22
- header = {"Content-Type": "application/json"}
22
+ header = {"Accept": "application/json"}
23
23
  if language:
24
24
  header["Accept-Language"] = language
25
25
 
@@ -56,7 +56,7 @@ class Audio:
56
56
 
57
57
  :return: A dictionary containing information about the default source.
58
58
  """
59
- header = {"Content-Type": "application/json"}
59
+ header = {"Accept": "application/json"}
60
60
  if language:
61
61
  header["Accept-Language"] = language
62
62
 
@@ -93,7 +93,7 @@ class Audio:
93
93
 
94
94
  :return: A list of available sinks.
95
95
  """
96
- header = {"Content-Type": "application/json"}
96
+ header = {"Accept": "application/json"}
97
97
  if language:
98
98
  header["Accept-Language"] = language
99
99
 
@@ -126,7 +126,7 @@ class Audio:
126
126
 
127
127
  :return: A list of available sources.
128
128
  """
129
- header = {"Content-Type": "application/json"}
129
+ header = {"Accept": "application/json"}
130
130
  if language:
131
131
  header["Accept-Language"] = language
132
132
 
@@ -21,7 +21,7 @@ class Auth:
21
21
 
22
22
  :return: JSON response from the server.
23
23
  """
24
- header = {"Content-Type": "application/json"}
24
+ header = {"Accept": "application/json"}
25
25
 
26
26
  try:
27
27
  response = self.client.get("/auth/apitokens", header=header)
@@ -61,11 +61,9 @@ class Auth:
61
61
 
62
62
  :return: JSON response from the server.
63
63
  """
64
- header = {"Content-Type": "application/json"}
65
-
66
64
  try:
67
65
  response = self.client.delete(
68
- f"/auth/apitokens/{tokenName}", header=header)
66
+ f"/auth/apitokens/{tokenName}")
69
67
 
70
68
  if isinstance(response, dict) and "status" in response:
71
69
  status_code = response["status"]
@@ -145,7 +143,7 @@ class Auth:
145
143
 
146
144
  :return: JSON response from the server.
147
145
  """
148
- header = {"Content-Type": "application/json"}
146
+ header = {"Accept": "application/json"}
149
147
 
150
148
  try:
151
149
  response = self.client.get("/auth/sessions", header=header)
@@ -197,7 +195,7 @@ class Auth:
197
195
  }
198
196
 
199
197
  params = {
200
- "useCookie": useCookie
198
+ "useCookie": str(useCookie).lower()
201
199
  }
202
200
 
203
201
  # Body mit den erforderlichen Parametern
@@ -20,7 +20,7 @@ class ChannelTypes:
20
20
 
21
21
  :return: A list of channel types.
22
22
  """
23
- header = {}
23
+ header = {"Accept": "application/json"}
24
24
  if language:
25
25
  header["Accept-Language"] = language
26
26
 
@@ -59,7 +59,7 @@ class ChannelTypes:
59
59
 
60
60
  :return: Details of the specific channel type.
61
61
  """
62
- header = {}
62
+ header = {"Accept": "application/json"}
63
63
  if language:
64
64
  header["Accept-Language"] = language
65
65
 
@@ -97,10 +97,9 @@ class ChannelTypes:
97
97
 
98
98
  :return: A list of item types.
99
99
  """
100
-
101
100
  try:
102
101
  response = self.client.get(
103
- f"/channel-types/{channelTypeUID}/linkableItemTypes")
102
+ f"/channel-types/{channelTypeUID}/linkableItemTypes", header={"Accept": "application/json"})
104
103
 
105
104
  if isinstance(response, dict) and "status" in response:
106
105
  status_code = response["status"]
@@ -1,6 +1,4 @@
1
1
  import requests
2
- import json
3
-
4
2
 
5
3
  class OpenHABClient:
6
4
  def __init__(self, url: str, username: str = None, password: str = None, token: str = None):
@@ -158,10 +156,11 @@ class OpenHABClient:
158
156
 
159
157
  :return: The response object with the SSE stream.
160
158
  """
159
+ self.session.headers.update({})
161
160
  if self.username is not None and self.password is not None:
162
- return self.session.get(url, auth=self.auth, stream=True)
161
+ return requests.get(url, auth=self.auth, headers={}, stream=True)
163
162
  else:
164
- return self.session.get(url, stream=True)
163
+ return requests.get(url, headers={}, stream=True)
165
164
 
166
165
  def __executeSSE(self, url: str, header: dict = {}):
167
166
  """
@@ -172,10 +171,14 @@ class OpenHABClient:
172
171
 
173
172
  :return: The response object with the SSE stream.
174
173
  """
174
+ if header is None:
175
+ header = {}
176
+
177
+ self.session.headers.update(header)
175
178
  if self.username is not None and self.password is not None:
176
- return self.session.get(url, auth=self.auth, headers=header, stream=True)
179
+ return requests.get(url, auth=self.auth, headers=header, stream=True)
177
180
  else:
178
- return self.session.get(url, headers=header, stream=True)
181
+ return requests.get(url, headers=header, stream=True)
179
182
 
180
183
  def get(self, endpoint: str, header: dict = None, params: dict = None):
181
184
  """
@@ -20,7 +20,7 @@ class ConfigDescriptions:
20
20
 
21
21
  :return: A list of configuration descriptions.
22
22
  """
23
- header = {}
23
+ header = {"Accept": "application/json"}
24
24
  if language:
25
25
  header["Accept-Language"] = language
26
26
 
@@ -59,7 +59,7 @@ class ConfigDescriptions:
59
59
 
60
60
  :return: Details of the specific configuration description.
61
61
  """
62
- header = {}
62
+ header = {"Accept": "application/json"}
63
63
  if language:
64
64
  header["Accept-Language"] = language
65
65
 
@@ -18,7 +18,7 @@ class Discovery:
18
18
  :return: Eine Liste der Bindings als Strings.
19
19
  """
20
20
  try:
21
- response = self.client.get("/discovery")
21
+ response = self.client.get("/discovery", header={"Accept": "application/json"})
22
22
 
23
23
  if isinstance(response, dict) and "status" in response:
24
24
  status_code = response["status"]
@@ -47,13 +47,13 @@ class Discovery:
47
47
 
48
48
  :return: Information about the discovery service for the specified binding.
49
49
  """
50
- headers = {}
50
+ header = {"Accept": "application/json"}
51
51
  if language:
52
- headers["Accept-Language"] = language
52
+ header["Accept-Language"] = language
53
53
 
54
54
  try:
55
55
  response = self.client.get(
56
- f"/discovery/bindings/{bindingID}/info", headers=headers)
56
+ f"/discovery/bindings/{bindingID}/info", header=header)
57
57
 
58
58
  if isinstance(response, dict) and "status" in response:
59
59
  status_code = response["status"]
@@ -19,9 +19,12 @@ class Iconsets:
19
19
 
20
20
  :return: A list of icon sets with details such as ID, label, description and supported formats.
21
21
  """
22
+ header = {"Accept": "application/json"}
23
+ if language:
24
+ header["Accept-Language"] = language
25
+
22
26
  try:
23
- response = self.client.get(
24
- "/iconsets", header={"Accept-Language": language} if language else {})
27
+ response = self.client.get("/iconsets", header=header)
25
28
 
26
29
  if isinstance(response, dict) and "status" in response:
27
30
  status_code = response["status"]
@@ -21,7 +21,7 @@ class Inbox:
21
21
  """
22
22
  try:
23
23
  response = self.client.get(
24
- "/inbox", params={"includeIgnored": str(includeIgnored).lower()})
24
+ "/inbox", header={"Accept": "application/json"}, params={"includeIgnored": str(includeIgnored).lower()})
25
25
 
26
26
  if isinstance(response, dict) and "status" in response:
27
27
  status_code = response["status"]
@@ -18,9 +18,8 @@ class Logging:
18
18
 
19
19
  :return: A list of loggers with names and levels.
20
20
  """
21
- header = {"Accept": "application/json"}
22
21
  try:
23
- response = self.client.get("/logging", header=header)
22
+ response = self.client.get("/logging", header={"Accept": "application/json"})
24
23
 
25
24
  if isinstance(response, dict) and "status" in response:
26
25
  status_code = response["status"]
@@ -85,6 +85,7 @@ class Sitemaps:
85
85
  :param pageID: The ID of the page.
86
86
  :param subscriptionID: Optional query parameter for the subscription ID.
87
87
  :param includeHidden: Whether hidden widgets should be included.
88
+ :param language: Optional language setting (as header).
88
89
 
89
90
  :return: The sitemap page (JSON).
90
91
  """
@@ -130,6 +131,7 @@ class Sitemaps:
130
131
  :param sitemapName: The name of the sitemap.
131
132
  :param subscriptionID: Optional query parameter for the subscription ID.
132
133
  :param includeHidden: Whether hidden widgets should be included.
134
+ :param language: Optional language setting (as header).
133
135
 
134
136
  :return: The complete sitemap (JSON).
135
137
  """
@@ -106,6 +106,7 @@ class ItemEventsTest:
106
106
 
107
107
  try:
108
108
  response = self.itemEventsAPI.ItemStateChangedEvent()
109
+ print("Response ItemStateChangedEvent():", response)
109
110
  with response as events:
110
111
  for line in events.iter_lines():
111
112
  line = line.decode()
@@ -55,10 +55,10 @@ class LinksTest:
55
55
 
56
56
  def testDeleteAllLinks(self, object: str):
57
57
  """ Test deleting all links """
58
- print("\n~~~~ Test #5: getDeleteAllLinks(object) ~~~~\n")
58
+ print("\n~~~~ Test #5: deleteAllLinks(object) ~~~~\n")
59
59
 
60
60
  try:
61
- orphanLinks = self.linksAPI.getDeleteAllLinks(object)
61
+ orphanLinks = self.linksAPI.deleteAllLinks(object)
62
62
  print(json.dumps(orphanLinks, indent=2))
63
63
  except Exception as e:
64
64
  print(f"Error retrieving orphan links: {e}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-openhab-rest-client
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: A Python client for the openHAB REST API. This library enables easy interaction with the openHAB REST API to control smart home devices, retrieve status information, and process events.
5
5
  Home-page: https://github.com/Michdo93/python-openhab-rest-client
6
6
  Author: Michael Christian Dörflinger
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="python-openhab-rest-client",
5
- version="0.2.0",
5
+ version="0.2.2",
6
6
  packages=find_packages(),
7
7
  install_requires=[
8
8
  "requests"
@@ -16,4 +16,5 @@ if __name__ == "__main__":
16
16
 
17
17
  # Run all tests
18
18
  discoveryTest.testGetDiscoveryBindings() # Test #1
19
+ discoveryTest.testGetBindingInfo("mqtt")
19
20
  discoveryTest.testStartBindingScan(bindingID) # Test #2
@@ -21,5 +21,6 @@ if __name__ == "__main__":
21
21
  linksTest.testGetLink(itemName, channelUID) # Test#2
22
22
  linksTest.testUnlinkItemFromChannel(itemName, channelUID) # Test#3
23
23
  linksTest.testLinkItemToChannel(itemName, channelUID) # Test#4
24
+ linksTest.testDeleteAllLinks(itemName)
24
25
  linksTest.testGetOrphanLinks() # Test#5
25
26
  linksTest.testPurgeUnusedLinks() # Test#6