maddox / wallop

📺 A transcoding server for your HDHomeRun Prime
167 stars 41 forks source link

500 Internal Server Error when getting channel list #37

Closed dilorc closed 9 years ago

dilorc commented 9 years ago

Hi,

When I use urllib or urllib2 in python to get a list of channels the servers returns an 500 error. I can use curl with no issue. I can also use urllib2 to tune and get the status of a channel. It only fails when I try to pull the list. Are there debug logs I can look at? I need to use python because I'm writing an XBMC plugin to play Wallop channels.

Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import urllib2 urllib2.urlopen("http://192.168.1.202:8888/channels") Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen return _opener.open(url, data, timeout) File "/usr/lib/python2.7/urllib2.py", line 410, in open response = meth(req, response) File "/usr/lib/python2.7/urllib2.py", line 523, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib/python2.7/urllib2.py", line 448, in error return self._call_chain(_args) File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain result = func(_args) File "/usr/lib/python2.7/urllib2.py", line 531, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 500: Internal Server Error

maddox commented 9 years ago

Did you set the IP address of your HDHomerun correctly in the config? Is your HDHomerun one of the original Duals? That one is not supported. Is your firmware up to date? You'll need up to date firmware to get your channel listings back.

dilorc commented 9 years ago

Yes, the IP is correct. It's the CableCard HDHomerun, the CC3 I believe. Firmware is 20140604.

curl works fine: curl http://192.168.1.202:8888/channels returns all the channels. It only happens when I use the Python library.

maddox commented 9 years ago

Very weird.

Are there debug logs I can look at?

It logs at logs/wallop.log. But they're not showing much except that a 500 is happening :/

I'm seeing this too. This is very weird.

maddox commented 9 years ago

Ok, it looks like that urlopen doesn't send a default accept header in it's request. If you add one it should be fine.

import urllib2

req = urllib2.Request('http://localhost:8888/channels')
req.add_header('Accept', 'application/json')
print urllib2.urlopen(req).read()
dilorc commented 9 years ago

Perfect! Thanks for the help and the quick turnaround!

Chris

On Fri, Oct 17, 2014 at 6:08 PM, Jon Maddox notifications@github.com wrote:

Ok, it looks like that urlopen doesn't send a default accept header in it's request. If you add one it should be fine.

import urllib2 req = urllib2.Request('http://localhost:8888/channels')req.add_header('Accept', 'application/json')print urllib2.urlopen(req).read()

— Reply to this email directly or view it on GitHub https://github.com/maddox/wallop/issues/37#issuecomment-59582900.