>
> import socket
> from urllib2 import urlopen
>
> # A one-hundredths of a second (0.01) timeout before socket throws
> # an exception to demonstrate catching the timeout.
> # Obviously, this you will set this greater than 0.01 in real life.
> socket.setdefaulttimeout(0.01)
>
> # example xml f
>
> Also, if you are using multiple threads to retrieve the xml source(s)
> and any thread blocks due to network problems, the thread can go way by
> itself after the default timeout expires.
>
>
Typo, edited for clarity:
That is: "..the thread can go *away* by itself after the default timeout
>
> import socket
> from urllib2 import urlopen
>
> # A one-hundredths of a second (0.01) timeout before socket throws
> # an exception to demonstrate catching the timeout.
> # Obviously, this you will set this greater than 0.01 in real life.
> socket.setdefaulttimeout(0.01)
>
> # example xml f
Anjanesh Lekshminarayanan wrote:
> fp = urllib.urlopen(url)
> data = fp.read()
>
> Retrieving XML data via an XML service API.
> Very often network gets stuck in between. No errors / exceptions.
>
> CTRL+C
>
> File "get-xml.py", line 32, in
> fp = urllib.urlopen(url)
> File "/usr/lib/py
Kill Joy wrote:
> Hi all.
>
> I have a mod_python script with two query:
>
> cursor = db.cursor()
>
> sql = 'SELECT * FROM users where username=\'' + username +'\''
> cursor.execute(sql)
> result = cursor.fetchall()
> num = int(cursor.rowcount)
>
> if num ==