Permalink
Browse files

Fix feedparser invocation in remote

In particular, the code to grab the name of a feed automatically.

Signed-off-by: Jack Miller <jack@codezen.org>
  • Loading branch information...
themoken committed Feb 8, 2012
1 parent 71243c9 commit c4f88d79f023cf34da72c1f193cfe1e8f5f6d671
Showing with 3 additions and 4 deletions.
  1. +3 −4 canto_next/remote.py
View
@@ -115,11 +115,10 @@ def _wait_response(self, cmd):
return None
def _autoname(self, URL):
- request = urllib.request.Request(URL)
- request.add_header('User-Agent',\
- 'Canto-Remote/0.8.0 + http://codezen.org/canto')
+ extra_headers = { 'User-Agent' :\
+ 'Canto/0.8.0 + http://codezen.org/canto' }
try:
- content = feedparser.parse(feedparser.urllib2.urlopen(request))
+ content = feedparser.parse(URL, request_headers = extra_headers)
except Exception as e:
print_wrap("ERROR: Couldn't determine name: %s" % e)
return None

0 comments on commit c4f88d7

Please sign in to comment.