Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6850451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:07:33+00:00 2026-05-27T01:07:33+00:00

Starting with urllib2 and feedparser libraries in Python I’m getting the following error most

  • 0

Starting with urllib2 and feedparser libraries in Python I’m getting the following error most of the time whenever try to connect and fetch content from particular URL:

urllib2.URLError: <urlopen error [Errno 110] Connection timed out>

The minimal reproducible examples (basic, using feedparser.parser directly and advanced, where I use urllib2 library first to fetch XML content) are pasted below.

# test-1
import feedparser
f = feedparser.parse('http://www.zurnal24.si/index.php?ctl=show_rss')
title = f['channel']['title']
print title

# test-2
import urllib2
import feedparser
url = 'http://www.zurnal24.si/index.php?ctl=show_rss'
opener = urllib2.build_opener()
opener.addheaders = [('User-Agent', 'Mozilla/5.0')]
request = opener.open(url)
response = request.read()
feed = feedparser.parse(response)
title = feed['channel']['title']
print title

When I try with different URL addresses (e.g., http://www.delo.si/rss/), everything works fine. Please note that all URL’s lead to non-english (i.e., Slovenian) RSS feeds.

I run my experiments both from local and remote machine (via ssh). The error reported occurs more frequently on remote machine, although it’s unpredictable even on local host.

Any suggestions would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:07:34+00:00Added an answer on May 27, 2026 at 1:07 am

    How often does the timeout occur? If it’s not frequent, you could wait after each timeout and then retry the request:

    import urllib2
    import feedparser
    import time
    import sys
    
    url = 'http://www.zurnal24.si/index.php?ctl=show_rss'
    opener = urllib2.build_opener()
    opener.addheaders = [('User-Agent', 'Mozilla/5.0')]
    
    # Try to connect a few times, waiting longer after each consecutive failure
    MAX_ATTEMPTS = 8
    for attempt in range(MAX_ATTEMPTS):
        try:
            request = opener.open(url)
            break
        except urllib2.URLError, e:
            sleep_secs = attempt ** 2
            print >> sys.stderr, 'ERROR: %s.\nRetrying in %s seconds...' % (e, sleep_secs)            
            time.sleep(sleep_secs)
    
    response = request.read()
    feed = feedparser.parse(response)
    title = feed['channel']['title']
    print title
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Starting with this from Corey Goldberg: #!/usr/bin/env python import json import pprint import urllib2
Following an advice in the answer: subclassing beautifulsoup html parser, getting type error ,
Starting with the error: Error 81 The OutputPath property is not set for this
Starting with the following LINQ query: from a in things where a.Id == b.Id
I have a webpage that I read using Python and BeautifulSoup, say soup=BeautifulSoup(urllib2.urlopen(site)) .
import os import sys, urllib2, urllib import re import time from threading import Thread
I'm just starting out in Python and I'm trying to request the html source
The following python curl call has the following successful results: >>> import subprocess >>>
Starting out with an int variable unix time stamp (something like 1290341015), is there
Starting a new thread... about same question.. I have tried all I am getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.