diff --git a/Timed Devices.indigoPlugin/Contents/Info.plist b/Timed Devices.indigoPlugin/Contents/Info.plist index 2d14172..47e35ec 100644 --- a/Timed Devices.indigoPlugin/Contents/Info.plist +++ b/Timed Devices.indigoPlugin/Contents/Info.plist @@ -3,7 +3,7 @@ PluginVersion - 0.0.19 + 0.0.20 ServerApiVersion 2.0 IwsApiVersion diff --git a/Timed Devices.indigoPlugin/Contents/Server Plugin/ghpu.py b/Timed Devices.indigoPlugin/Contents/Server Plugin/ghpu.py index 0c89641..25df95c 100755 --- a/Timed Devices.indigoPlugin/Contents/Server Plugin/ghpu.py +++ b/Timed Devices.indigoPlugin/Contents/Server Plugin/ghpu.py @@ -131,27 +131,29 @@ def getRateLimit(self): # form a GET request to api.github.com and return the parsed JSON response def _GET(self, requestPath): self._debug('GET %s' % requestPath) - headers = { 'User-Agent': 'Indigo-Plugin-Updater', 'Accept': 'application/vnd.github.v3+json' - } - + } data = None - - conn = httplib.HTTPSConnection('api.github.com') - conn.request('GET', requestPath, None, headers) - - resp = conn.getresponse() - self._debug('HTTP %d %s' % (resp.status, resp.reason)) - - if (resp.status == 200): - data = json.loads(resp.read()) - elif (400 <= resp.status < 500): - error = json.loads(resp.read()) + requestPath = 'https://api.github.com'+ requestPath + #conn = httplib.HTTPSConnection('api.github.com') + #conn.request('GET', requestPath, None, headers) + #resp = conn.getresponse() + f = subprocess.Popen(["curl", requestPath], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False) + #'-H', str(headers), "-k", + out, err = f.communicate() + self._debug(u'HTTP Err result:'+unicode(err) ) + self._debug(u'ReturnCode:{0}'.format(unicode(f.returncode))) + #self.sleep(1) + if (int(f.returncode) == 0): + data = json.loads(out) + self._debug(u'Json results:'+unicode(data)) + elif (400 <= f.status < 500): + error = json.loads(out) self._error('%s' % error['message']) else: - self._error('Error: %s' % resp.reason) + self._error('Error: %s' % unicode(err)) return data