#24 API Token Support

This commit is contained in:
David Zingg 2020-07-01 21:25:06 +02:00
parent b3e53821bb
commit 7d80c84393
2 changed files with 9 additions and 9 deletions

17
.idea/workspace.xml generated
View File

@ -2,7 +2,6 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="7e2e0eec-b22e-4d48-8f24-196d1ed9b51a" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -48,13 +47,6 @@
<option name="presentableId" value="Default" />
<updated>1574193087583</updated>
</task>
<task id="LOCAL-00050" summary="#15 Beschreibung erstellen">
<created>1574876224274</created>
<option name="number" value="00050" />
<option name="presentableId" value="LOCAL-00050" />
<option name="project" value="LOCAL" />
<updated>1574876224274</updated>
</task>
<task id="LOCAL-00051" summary="#15 Beschreibung erstellen">
<created>1574876349466</created>
<option name="number" value="00051" />
@ -391,7 +383,14 @@
<option name="project" value="LOCAL" />
<updated>1593630650365</updated>
</task>
<option name="localTasksCounter" value="99" />
<task id="LOCAL-00099" summary="#24 API Token Support">
<created>1593631193159</created>
<option name="number" value="00099" />
<option name="presentableId" value="LOCAL-00099" />
<option name="project" value="LOCAL" />
<updated>1593631193159</updated>
</task>
<option name="localTasksCounter" value="100" />
<servers />
</component>
<component name="UnknownFeatures">

View File

@ -180,6 +180,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
headers = {}
if self.token is not None and self.token != "":
headers = {"Token": self.token}
self._logger.info(headers)
request = requests.get(
'http://{}/report'.format(self.ip), headers=headers, timeout=1)
if request.status_code == 200: