Forums

RSS feedparser.parse

I am having a problem on my paid account parsing RSS feeds using the feedparser.parse module.

The two urls I am having trouble parsing are: https://www.nasdaq.com/feed/rssoutbound?symbol={}

where {} = 'AAPL', for example,

and https://www.nasdaq.com/feed/rssoutbound?category=Investing

feed = feedparser.parse(url) ^CTraceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/stockings/.local/lib/python3.9/site-packages/feedparser/api.py", line 216, in parse
data = _open_resource(url_file_stream_or_string, etag, modified, agent, referrer, handlers, request_headers, result)
File "/home/stockings/.local/lib/python3.9/site-packages/feedparser/api.py", line 115, in _open_resource
return http.get(url_file_stream_or_string, etag, modified, agent, referrer, handlers, request_headers, result)
File "/home/stockings/.local/lib/python3.9/site-packages/feedparser/http.py", line 171, in get
f = opener.open(request)
File "/usr/local/lib/python3.9/urllib/request.py", line 517, in open
response = self._open(req, data)
File "/usr/local/lib/python3.9/urllib/request.py", line 534, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/usr/local/lib/python3.9/urllib/request.py", line 494, in _call_chain
result = func(*args)
File "/usr/local/lib/python3.9/urllib/request.py", line 1389, in https_open
return self.do_open(http.client.HTTPSConnection, req,
File "/usr/local/lib/python3.9/urllib/request.py", line 1350, in do_open
r = h.getresponse()
File "/usr/local/lib/python3.9/http/client.py", line 1345, in getresponse
response.begin()
File "/usr/local/lib/python3.9/http/client.py", line 307, in begin
version, status, reason = self._read_status()
File "/usr/local/lib/python3.9/http/client.py", line 268, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/local/lib/python3.9/socket.py", line 704, in readinto
return self._sock.recv_into(b)
File "/usr/local/lib/python3.9/ssl.py", line 1241, in recv_into
return self.read(nbytes, buffer)
File "/usr/local/lib/python3.9/ssl.py", line 1099, in read
return self._sslobj.read(len, buffer)
KeyboardInterrupt

Based on the last few lines of the callback, it looks like there is an issue with ssl.py

Is there an SSL certificate I need to set up or something?

I receive similar errors when running

requests.get(url)

I made sure to install the most recent versions of feedparser for python3.7 and python 3.9 using:

$ pip install --user feedparser

$ pip install --user --upgrade feedparser

$ pip3.7 install --user feedparser

$ pip3.7 install --user --upgrade feedparser

It looks like you were running the code in the console and interrupted it -- could you show the actual error message?

right. the console (and also web application) stalls indefinitely unless I interrupt it. therefor there is no other error message from the console I can provide, sorry.

I did forget to mention though that I do not run into this problem when parsing RSS feeds from

url = 'https://www.investing.com/rss/stock_stock_picks.rss'

feed = feedparser.parse(url)

Could nasdaq.com be blacklisted?

Is it working outside of PythonAnywhere? What do you get when you curl those links?

Yes, it worked on my console (python3.7.4 and feedparser5.2.1).

I guess the problem was that this specific url doesn't work with feedparser6.0.10 on python3.7

I just started a virtualenv running python3.7 and feedparser5.2.1 and everything worked great!

Problem solved! Thank you for help

Glad you got that working!