Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a timeout parameter to the parse function #80

Closed
wants to merge 1 commit into from

Conversation

JPFrancoia
Copy link

The default is set to 30 seconds.

I only saw #77 after I made my corrections. However PR 77 introduces a hardcoded parameter, and does not respect the API of feedparser.

I recommend using this PR instead of 77.

Usage:

    feed = feedparser.parse("http://feeds.rsc.org/rss/cc", timeout=1)

But old syntax will still work, of course:

    feed = feedparser.parse("http://feeds.rsc.org/rss/cc")

@peterashwell
Copy link

cool 👍

@rhoog
Copy link

rhoog commented Feb 23, 2017

👍

@kut
Copy link

kut commented Jun 28, 2017

Agreed this would be awesome. should the default timeout actually be -1 so existing usages of feedparser.parse would behave exactly the same?

I've had to build a workaround using the requests library in the meantime, would love to switch back to using only feedparser, but there's no other clean way besides fussing with global/thread timeout.

@keithfma
Copy link

This feature would be very useful -- any plans to merge?

@JPFrancoia
Copy link
Author

I think this repo is dead, isn't it ? This PR is one year old.

This was referenced Oct 26, 2017
@kurtmckee
Copy link
Owner

My plan is to remove custom HTTP code from feedparser at some point in the future. Therefore I don't want to encourage people to depend on HTTP features in feedparser and would instead suggest using far more robust libraries like requests.

I have consistently rejected adding timeouts to feedparser. Please consider using a library like requests instead. 😄

@kurtmckee kurtmckee closed this Dec 22, 2018
@peterashwell
Copy link

peterashwell commented Dec 22, 2018 via email

@JPFrancoia
Copy link
Author

@kurtmckee so what's your advice on this one? use requests to fetch the page and then parse it with feedparser? In this case what's the point of feedparser, we could do it with any other xml parser, no?

@buhtz
Copy link

buhtz commented Dec 23, 2018

@peterashwell I think you missunderstood Kurts answer.

@JPFrancoia Your are part right. But using another xml parser would cause you a lot more work. Because feedparser does more then just parsing the xml. It interprete the data in the context of feeds.

IMO this packages is essential for me (currently working on a feedreader).

@kurtmckee
Copy link
Owner

kurtmckee commented Dec 23, 2018 via email

@introspectionism
Copy link

@kurtmckee
it sounds like a good idea to me, to remove the custom-made http code from feedparser. then the code base will get leaner. the focus is to parse the content, not doing http requests.

just re-wrote my implementation to use urllib.request to fetch the data, instead of parsing the data from a remote url.

marado added a commit to marado/hattai-fortune that referenced this pull request Dec 26, 2019
feedparser is great at parsing feeds, not at fetching data.
Following its author's recommendation[1], we are no longer relying
on feedparser to fetch the feeds, and instead we use 'requests'.

[1] kurtmckee/feedparser#80

Closes: #12
@adbenitez
Copy link

adbenitez commented Aug 15, 2021

I had issues with connection hanging forever, my recommendation is to remove then the broken HTTP client, and expect the data to be passed directly to feedparser.parse(), otherwise fix the thing, it doesn't makes sense to ship something broken.

(btw, thanks for this library, it is really helpful :)

@buhtz
Copy link

buhtz commented Aug 16, 2021

@kurtmckee I know that there is currently no time schedule for removing the HTTP-request part from feedparser. But maybe it is a good idea to add a deprecation warning to the next release if someone use it.

ikwyl6 added a commit to ikwyl6/rss-checker that referenced this pull request Sep 22, 2021
…e/feedparser#80) as per feedparser author and pass data only to feedparser. Add exceptions to catch timeouts and sites having network connections not working
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants