Quantcast
Channel: Active questions tagged feedparser - Stack Overflow
Viewing all articles
Browse latest Browse all 105

Accessing passwort-protected feeds with feedparser on Python 3

$
0
0

I am trying to access a passwort-protected feed with feedparser. According to the feedparser docs, it can be done this way:

import urllib2, feedparserauth = urllib2.HTTPDigestAuthHandler()auth.add_password('DigestTest', 'feedparser.org', 'test', 'digest')d = feedparser.parse('http://feedparser.org/docs/examples/digest_auth.xml',                      handlers=[auth])

However, I am using Python 3.8, so there is no urllib2 available, but only urllib3. What do I have to do to make the authentification working?

I have already tried to simply replace urllib2 by urllib3, which is not working, as "module 'urllib3' has no attribute 'HTTPDigestAuthHandler'".

I also tried to use

from requests.auth import HTTPDigestAuthauth=HTTPDigestAuth('user', 'pass')d = feedparser.parse('http://feedparser.org/docs/examples/digest_auth.xml',                          handlers=[auth])

but I receive a "TypeError: expected BaseHandler instance, got <class 'requests.auth.HTTPDigestAuth'>"


Viewing all articles
Browse latest Browse all 105

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>