[FIX] Comply with PR comments
@@ -16,7 +16,7 @@ Configuration parameters:
(default "{stream_name} is offline.")
stream_name: name of streamer(twitch.tv/<stream_name>)
(default None)
- twitch_client_id: Your client id. Create your own key at http://dev.twitch.tv
+ client_id: Your client id. Create your own key at http://dev.twitch.tv
(default None)
Format placeholders:
@@ -26,6 +26,14 @@ Color options:
color_bad: Stream offline or error
color_good: Stream is live
+Client ID:
+ Example settings when creating your app at http://dev.twitch.tv
+
+ Name: <your_name>_py3status
+ OAuth Redirect URI: http://localhost
+ Application Category: Application Integration
+
+
@author Alex Caswell horatioesf@virginmedia.com
@license BSD
@@ -48,14 +56,14 @@ class Py3status:
format_invalid = "{stream_name} does not exist!"
format_offline = "{stream_name} is offline."
stream_name = None
- twitch_client_id = None
+ client_id = None
def post_config_hook(self):
self._display_name = None
def _get_display_name(self):
url = 'https://api.twitch.tv/kraken/users/' + self.stream_name
- display_name_request = requests.get(url, headers={'Client-ID': self.twitch_client_id})
+ display_name_request = requests.get(url, headers={'Client-ID': self.client_id})
self._display_name = display_name_request.json().get('display_name')
def is_streaming(self):
@@ -65,7 +73,9 @@ class Py3status:
'cached_until': self.py3.CACHE_FOREVER
}
- r = requests.get('https://api.twitch.tv/kraken/streams/' + self.stream_name, headers={'Client-ID': self.twitch_client_id})
+ r = requests.get('https://api.twitch.tv/kraken/streams/' + self.stream_name,
+ headers={'Client-ID': self.client_id}
+ )
if not self._display_name:
self._get_display_name()
if 'error' in r.json():
